tecnickcom / tc-lib-pdf Goto Github PK
View Code? Open in Web Editor NEWTCPDF - PHP PDF Library - https://tcpdf.org
License: Other
TCPDF - PHP PDF Library - https://tcpdf.org
License: Other
Hi,
if I convert a font using http://fonts.snm-portal.com I get a working font, but even if I convert a bold or heavy style, I get only a thin/regular one (char width is different but the chars itself are thin/regular).
Same happens when I use tcpdf_addfont.php to convert the fonts setting platform-id to 3 (windows).
When I set platform-id to 1 (mac) and encoding-id to 0 I get a correct looking font (bold/heavy) but it works only for ASCII-characters but not for example with german umlauts.
Any idea?
thank you and best regards
Gabriel
Hello! Thanks for your work on this package.
I have an issue where the images seem to have some transparency instead of rendering full color,
Please see page 2 of this pdf,
http://customizer.prolook.com/design_sheets/A6D6B362-32E6-5154-93EB-59FC24258811.pdf
Also theres a small thumbnail of a mascot on page 5, the appear to have some king of transparency setting.
The full color of the image which is also the same as the source image being used by the pdf is at
https://s3-us-west-2.amazonaws.com/uniformbuilder/uploads/staging/884ab11e1d16911d3d41aae1334ca4b9.png
Thanks! Any help would be really appreciated.
PHP Fatal error: Call to undefined method Com\Tecnick\Pdf\Tcpdf::getOutOutput() in \vendor\tecnickcom\tc-lib-pdf\src\Output.php on line 109
Thanks for all the amazing work.
I'm a big fan of TCPDF and use it in multiple projects, and I'd love to use an more up to date library.
Is this library useable for simple needs ?
Is there a roadmap or a backlog where we could pick tickets if we want to help ?
I am using PHP code to set the initial state on a radio button. When I view the rendered PDF it doesn't show the checked button. I can mouse over and check the 'hidden' button and it then shows as checked --- any ideas ?
Using TCPDF 6.2.13 with Adobe Reader 15.020.20039 on Windows 7
Hi there,
I am looking for help regarding adding a custom font with Default, Italic and Bold style, as I tried a couple ways and con't figure out the proper way of doing it.
FontStyles::DEFAULT => TCPDF_FONTS::addTTFfont(public_path('fonts/modele-exports/avenir.ttf'), '', '', 32)
FontStyles::BOLD => TCPDF_FONTS::addTTFfont(public_path('fonts/modele-exports/avenirB.ttf'), '', '', 32)
FontStyles::ITALIC => TCPDF_FONTS::addTTFfont(public_path('fonts/modele-exports/avenirI.ttf'), '', '', 32)
if I then use SetFont with B or I followed by MultiCell, it works the whole text is properly formated. But If I use SetFont Default and use tags in my text, they are not respected. Using a default font works properly so I guess the problem comes from how I import the font or something similar
Is there a way to add the font so that different styles work correctly ?
Thanks
I see that TCPDF is now considered obsolete but seeing as this library is still in development I'm wondering if you would accept PRs on the old library that update for PHP 7.3 compatibility?
php 5.4 is dead for over a year now, maybe support for it could be dropped. It should avoid compatibility issues like 60a068e
Version 5.5 is also dropped since a few months (just saying ๐ )
See https://secure.php.net/supported-versions.php
This error has occurred on TCPDF 6.0.87. I am not sure whether it will still occur in tc-lib-pdf.
When signing a PDF document, if signature exceeds signature_max_length
, no error gets caught, no error message gets printed, but PDF document becomes corrupt.
When opening a signed PDF in Adobe Reader, it shows these errors :
While opening the file, it says
This file is damaged but is being repaired
The blue ribbon on top says
Certification by is invalid
When opening the signature panel, it says
Certified by %s
Details of errors say
There are errors in the formatting or information contained in this signature (support information: SigDict /Contents illegal data)
When clicking on "Certificate details", nothing happens
Screenshot:
A sample PDF so signed can be found at https://witnesser.co/images/158571879168934339.pdf
A solution could probably be to detect signature length before inserting it, check whether it fits limit, and if not, either throw an error, or increase limit.
I use the latest version of TCPDF looking forward to the new release, I have a problem with the borders of an HTML table as described in http://stackoverflow.com/questions/38505197/tcpdf-html-table-border-not-render-correctly there is a solution or do I have to wait for the new version?
hello,
I have a question about the old version of the library. I'm trying to sign a pdf document and i keep getting this error :
Warning: openssl_pkcs7_sign(): error getting private key in C:\xampp\htdocs\ANA\TCPDF-masterV3\tcpdf.php on line 7600
Notice: Undefined offset: 1 in C:\xampp\htdocs\ANA\TCPDF-masterV3\tcpdf.php on line 7610
TCPDF ERROR: Some data has already been output, can't send PDF file
Sorry for posting here but the old version doesn't have an issues section. Any help would be appreciated . Thank you very much!
Can Bower support be added so that this can be pulled via Bower? Bower can do git pulls, but a module would be better.
Hi,
i searched the web for it but did'n find any solution.
is there a way to output a table cell with auto width according to its content? (generated with html content/ writeHTML function).
for now my table cells has the same with.
greeting mike
Hello @nicolaasuni
Is there is any option for pdf to convert it in to High Quality Print as PDF preset
I have created one .pdf file using TCPDF library in php. Which contain one image layer and above that one svg path. However this part are working well, But problem is i need that .pdf file in High Quality Print preset standard.
Please check attachment.
Any feedback will be much appreciate.
Hi,
First of all: thank you for your continuous efforts on TCPDF/tc-lib-pdf.
I've been looking into what library I should be using and yours seems to be having quite some features.
I've tried using tc-lib-pdf however I didn't got it to work and I'm unsure what I'm doing wrong.
When trying TCPDF I had no issues and could rather quickly find my way into creating a basic PDF. However I wonder what's the use of learning the "old" TCPDF when you're building tc-lib-pdf as it's successor(I'd rather immediately go that way). I've been trying to find some basic example on how to use your code but that fails.
IMHO I think the examples are great for TCPDF but the site is misleading in refering to the tc-lib-pdf repo by default (I only noticed after a while that that is why the examples didn't work).
Also: the installation notes seem very limited(actually hit the API limiter on github with the instructions on the site). I understand you want to make use of some technologies like composer. However for someone who's not been working with PHP that much recently it's unclear on what steps are now needed to make actual use of your project(for example the site refers to creating a composer.json but not if you'd need to execute anything else like: composer install).
My actual question is if you'd be so kind to make a basic project example using tc-lib-pdf.
So for example:
Get the git repository:
git clone ...
Get the dependencies;
composer install
Create a file:
example.php
Add the following to example.php to include tc-lib-pdf to your project (to make use of the namespaces, ...):
...
You can create a basic PDF like this:
...
To create and view the docs do;
...
And maybe clearly differentiate on the website between TCPDF and tc-lib-pdf (with the different repo names).
I think it'd help a lot of people in getting on the new tc-lib-pdf wagon.
Thanks in advance for your continuous efforts!
Hi, does tcpdf support datauri in writehtml src tags?
(i'm using elibyy/tcpdf-laravel)
i don't want to store the signatures from my clients on my server so instead i've tried to store them as datauri's in my db.
example code:
$html .='<img src="'.$data_uri.'" width="300">';
PDF::Writehtml($html);
i get an empty space where the signature should come.
i can achieve this with PDF::Image('a'.$datauri) however its not responsive to my pdf then..
Thanks in advance
(I will report this in the new library, because I cannot open issues on the deprecated old one)
When mixing some RTL characters with some other UTF8 characters in the same HTML node, like when mixing Chinese characters and Arabic characters (ๅซ ุท), then TCPDF screams a notice and the PDF is not built.
This happens on latest 6.2 version of TCPDF (and on elder ones like 5.9), using PHP 5.6.25
Showcase:
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__);
spl_autoload_register();
error_reporting(E_ALL);
$pdf = new TCPDF('P', 'mm', 'A4');
// This one works
//$string = "<span>嫀</span> <span>ط</span>";
//
// This one fails
$string = "嫀 ط";
echo($string);
var_dump($string);
$pdf->AddPage();
$pdf->writeHTML($string);
$pdfContent = $pdf->Output('doc.pdf', 'S');
// Screams ( ! ) Notice: Undefined offset: 23232 in C:\wamp\www\TCPDF-master\include\tcpdf_fonts.php on line 2119
var_dump($pdfContent);
Result:
ๅซ ุท
C:\wamp\www\TCPDF-master\test-8576.php:16:string 'ๅซ ุท' (length=16)
( ! ) Notice: Undefined offset: 23232 in C:\wamp\www\TCPDF-master\include\tcpdf_fonts.php on line 2119
And the PDF is not generated.
I have a question out on stack overflow,
That pertains to multicell()
and borders, where would the best place to get answers to questions like this? is it here, StackOverflow, somewhere else?
Any help/direction much appreciated.
Hello,
this is my code:
$pdf->LinearGradient($x, $y, $width, $height, $darkblue, $lightblue);
If I give colors in RGB like
$darkblue = array(2, 63, 17);
$lightblue = array(170, 195, 226);
the result is a sort of green instead of blue
If I give colors in CMYK format
$darkblue = array(251, 118, 0, 138);
$lightblue = array(64, 34, 0, 29);
the result is different bands of different colors with very few gradient (the blu I want, but then magenta, then violet, then amaranto and then again blue)
Can you reproduce the same issue?
Some hints?
Thank you in advance
Gianluca
If you plan to copy over the barcode code from TCPDF, I'd like to point out that the QRCODE generation seems to choose a different 'best' solution on each request instead of the 'best' method which means you get a different image on each request.
Hi Guy!
Really thank you for make PDF library. It is very useful.
I have problem when make pdf with add timestamp
and signature
for pdf. Do you know any document relative with timestamp and signature function in PDF. Example
Hope you reply to me.
Thanks so much
a href="http://sourceforge.net/donate/index.php?group_id=128076"> MAKE A DONATION!
thanks, advance.
how can i add new fonts to this library and use it in creating pdfs
Hi there! ๐
I just wanted to give this a spin for the first time, but after installing it via composer, it's just kind of empty. This is the Tcpdf-class, for example (./vendor/tecnickcom/tc-lib-pdf/src/Tcpdf.php):
<?php
/**
* Tcpdf.php
*
* @since 2002-08-03
* @category Library
* @package Pdf
* @author Nicola Asuni <[email protected]>
* @copyright 2002-2016 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf
*
* This file is part of tc-lib-pdf software library.
*/
namespace Com\Tecnick\Pdf;
use \Com\Tecnick\Pdf\Exception as PdfException;
/**
* Com\Tecnick\Pdf\Tcpdf
*
* Tcpdf PDF class
*
* @since 2002-08-03
* @category Library
* @package Pdf
* @author Nicola Asuni <[email protected]>
* @copyright 2002-2016 Nicola Asuni - Tecnick.com LTD
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* @link https://github.com/tecnickcom/tc-lib-pdf
*/
class Tcpdf
{
/**
* Information string
*
* @var string
*/
protected $info = '';
/**
* Initialize
*
* @TODO
*/
public function __construct()
{
$this->info = 'THIS PROJECT IS UNDER CONSTRUCTION';
}
/**
* Example method
*
* @TODO
*/
public function getInfo()
{
return $this->info;
}
}
Any idea what I am doing wrong?
I should have posted to stable version, please disregard this.
I'm using the TCpdf but I was facing one issue with the formatting.
In my application, we accepting the data from end users and based on provided data we create pdf using TCpdf. (using PHP)
The issue is when end users copy data from word document/ existing other pdf and paste into provided text area. so its include the word formatting and bullets and all. It's stored as it is in my database, Once I send that information to TCpdf then TCpdf skip the formatted data and generate blank pdf.
All the pages in the docs show 404 page not found. Any idea?
PHP7.2.9
Accessing static property Com\Tecnick\Pdf\Tcpdf::$valid_zoom as non static in D:\www\photon\SchoolBusManager\vendor\tecnickcom\tc-lib-pdf\src\Tcpdf.php on line 170
Cause a warning of in_array()
function in the same line.
Correct by :
if (is_numeric($zoom) || in_array($zoom, self::$valid_zoom)) {
Hi,
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="900" height="1162" style="background-color: rgba(255, 255, 255, 1)" viewBox="0 0 900 1162" xml:space="preserve">
<g transform="translate(308.33 222.92)">
<image id="28497" xlink:href="/var/www/server2/image.png" x="-41.6666666666665" y="-18.75" style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" width="83.333333333333" height="37.5" preserveAspectRatio="none"></image>
</g>
</svg>
/var/www/server1/
./var/www/server2/image.png
The problem lies here: https://github.com/tecnickcom/TCPDF/blob/master/tcpdf.php#L24189. IMO, you should not be fixing absolute paths...
Thanks!
Is there a way to set a tables width, height, xPos, and yPos?
Hi there,
Can you define interface that library will be defined?
Thanks to interface, we can fill it with implementation and go on with development of this great library.
Do you have plan for creating PDF content?
Best regards,
Maciek
Examples from docs doesn't works.
Call to undefined method Com\Tecnick\Pdf\Tcpdf::writeHTML()
It would be great if an already existing PDF file could be opened and new pages added to it.
I am using TCPDF with jetty and quercus engine to generate PDFs. PDF are getting generated successfully but no text at all. When i did some preflights on generated pdf i found below error
Analyze Outlines.
Analyze Pages.
0x80410503 - E - The operator has an invalid number of operands.
- File: server.pdf
0x80410513 - E - An end text operator is missing.
- File: server.pdf
0x80410113 - E - The file is corrupt and cannot be repaired. Some of the contents can possibly be recovered.
- Page No.: 1
- File: server.pdf
Save output file.
0x80410503 - E - The operator has an invalid number of operands.
- Page No.: 1
- File: server.pdf
0x80410513 - E - An end text operator is missing.
- Page No.: 1
- File: server.pdf
Close file.
3-Heights(TM) PDF repair tool, evaluation license valid until unbounded
below is code --
` $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setFontSubsetting(false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Anil Funde');
$pdf->SetTitle('TCPDF Example 002');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
#$fontname = TCPDF_FONTS::addTTFfont('../fonts/TimesSRegular.ttf', 'TrueType','ansi', 32);
// set font
#$pdf->SetFont($fontname, '', 20);
// ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set some text to print
#$txt ="test222222222222";
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_002.pdf', 'I');`
I tried same code in XAMP enviorenment (apache/php) and it worked very well there and pdf generated in xamp environment get validated successfully.
While debugging, on jett/quercus environment i removed write() call and tried to generate blank pdf, generated pdf get validated successfully. Looks like write() and similar methods messing up something.
Hi Nicola,
When I add Hebrew text within text annotation, I cant so it well on Chrome browser (the latest versions) but it showing good on Firefox.
chrome :
Firefox :
I think it because chrome doesn't support encoding any more...
Is the text annotation function will support UTF-8 in the near future ? or there is others options to add the text that will be show good in Chrome ?
Thank you,
Roy
Please prepare library for PHP 7.1 and deprecated mcrypt_*
see https://wiki.php.net/rfc/mcrypt-viking-funeral
Hi Nicola,
First of all - thank you for tcPDF. You're a life-saver.
Would it be possible to add support for text-decoration
attribute in SVG text.
Possible styles:
Currently, text-decoration
is ignored when SVG is added to PDF.
<g id="28493" transform="translate(201 242)">
<text font-family="arial" font-size="177" font-weight="normal" text-decoration="underline" style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: bevil; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" >
<tspan x="-59" y="55.75" fill="rgb(0, 0, 0)">A</tspan>
</text>
</g>
Thanks!
I have searched the solution and i found https://sourceforge.net/p/tcpdf/discussion/435311/thread/5d275055/ .
But i'm not sure how to do it, anyone can guide me pls?
Khmer Character list : http://www.selapa.net/khmerfonts/characterlist.php
Hi,
Is there a release date for this new library? 2017? 2018?
Does it support PHP 7?
The old lib (but currently active one) seems not to support it?
Will it have a completly new API or could one simply migrate from the old lib to the new one?
It seems to be a great project - thank you!
Hello, we're scanned https://tcpdf.org/ for HTML and accessibility issues and found the following errors:
https://rocketvalidator.com/s/1da204e7-d2f5-4fec-a2ba-a80ef3a4da8e/p
I can't post it on [email protected]
github version.
As of php 7.1
mcrypt_get_cipher_name
is deprecated. Can You change it?
http://php.net/manual/en/function.mcrypt-get-cipher-name.php
Hi TCPDF Team
I am using TCPDF for create PDF. I want to use input box and check box in PDF. Input box is working but i am not able to add height and width for input box and check boxes.
Please suggests me how we have to use height and width properties for input box and check boxes.
Regards
Mohit kumar
[email protected]
Hi there,
Thanks for TCPDF.
I've encountered some problems with validating PDF/A 1b seems there's a missing definition for:
<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>
Apache preflight validation (java -jar preflight-app-2.0.11.jar flie-xxx.pdf) lead to:
7.5 : Error on MetaData, Missing pdfaSchema:property in type definition
Btw adding an extra definition to pdf schema solve the problem i've added a pull request for reference.
Also VeraPDF validation fails for font-glyphs related problem but seems that VeraPDF has some problems in fonts handling.
Thanks kind regards
Rob
TCPDF is currently my backbone when it comes to creating PDFs on the fly, everything else just seems to fall short when you get into complex requirements like emailing printing and now signing. Seriously thanks for all that!
We're running into an issue with the previous library and time stamping, I can see it was planned but never implemented, and I'm beginning to see why; it's not really complex just more of a pain to get the tsq for the pdf.
Essentially this is the process as I understand it, (I'm totally open for correction as I am nearly fried at this point with all of this)
openssl ts -query -data TCPDFFILE.pdf -no_nonce -sha512 -cert -out file.tsq
If it were possible, I would think it would make sense to just emit the response from the timestamp authority to a variable to later be inserted into the signature. Same thing with the cert?
Like I said though, this is all very new to me and I'm looking to better understand the process to better implement it.
I'm generating PDF files on the fly with user content which could contain emoji-characters.
Currently I'm using a custom font and emoji-characters don't get displayed in the PDF (some are totally hidden, some are printed in unknown characters).
To be honest, I don't know exactly where to start looking. Should my custom font include the emoji-characters? Or can I do something else to include them?
I've tried both MultiCell
and writeHTMLCell
.
Thanks!
Hello.
There is a code in TCPDF
$pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'http://localhost.ru/pdf.php#XFDF', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64)));
Could you, please, tell me, where can i see all array Flags (such as 'F', 'S', 'ExportFormat' and so on).
I can't find it in documentation.
Thank you!
Where to see the full documentation for the new version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.