TCPDF | Official clone of PHP library | Document Editor library

 by   tecnickcom PHP Version: 6.6.2 License: Non-SPDX

kandi X-RAY | TCPDF Summary

kandi X-RAY | TCPDF Summary

TCPDF is a PHP library typically used in Telecommunications, Media, Media, Entertainment, Editor, Document Editor, Composer applications. TCPDF has no bugs and it has medium support. However TCPDF has 2 vulnerabilities and it has a Non-SPDX License. You can download it from GitHub.

PHP library for generating PDF documents on-the-fly.

            kandi-support Support

              TCPDF has a medium active ecosystem.
              It has 3727 star(s) with 1423 fork(s). There are 176 watchers for this library.
              It had no major release in the last 6 months.
              There are 253 open issues and 69 have been closed. On average issues are closed in 76 days. There are 18 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of TCPDF is 6.6.2

            kandi-Quality Quality

              TCPDF has 0 bugs and 0 code smells.

            kandi-Security Security

              TCPDF has 2 vulnerability issues reported (1 critical, 1 high, 0 medium, 0 low).
              TCPDF code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              TCPDF has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              TCPDF releases are not available. You will need to build from source code and install.
              It has 50704 lines of code, 718 functions and 171 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed TCPDF and discovered the below as its top functions. This is intended to give you an instant insight into TCPDF implemented functionality, and help decide if they suit your requirements.
            • Add a TTF font
            • Set barcode
            • ASCII8 decoding
            • Decode LZWData decode .
            • Decode a xref entry
            • Get Barcode Data
            • Converts HTML color to decimal
            • Write a multi row
            • Get XREF data
            • Import a PDF file
            Get all kandi verified functions for this library.

            TCPDF Key Features

            No Key Features are available at this moment for TCPDF.

            TCPDF Examples and Code Snippets

            No Code Snippets are available at this moment for TCPDF.

            Community Discussions


            PHPSpreadsheet writer - How to fit content
            Asked 2022-Mar-30 at 10:31

            I've successfully convert Excel to PDF using this code:



            Answered 2022-Mar-30 at 10:31

            I think there's no solution for this. So I just reduce the font size. When my data is small, the paper space will be wasted



            Images are not displaying using DOMPDF library
            Asked 2022-Mar-19 at 09:05

            Below is my PHP code to convert HTML into PDF, but images are not displaying under PDF. I tried to use both local paths as well as server URLs as well, both are not displaying images under PDF.



            Answered 2022-Mar-19 at 09:05

            Since URLs can point anywhere and that is not how pdfs are supposed to work, you have to embed your whole image by encoding it as base64

            like this example here



            Remove 'E' output headers from base64 string in TCPDF
            Asked 2022-Feb-19 at 22:14

            I'm using TCPDF using



            Answered 2022-Feb-18 at 18:12

            TCPDF docs are huge but unusable – it's easier to read the source code directly. It has those extra headers because you're asking for them by using the E output mode, which is intended for generating email messages.

            For sending the PDF data as a PHPMailer attachment, you want the straight binary PDF data as a string, as provided by the S output mode, which you can pass straight into addStringAttachment(), and PHPMailer will handle all the encoding for you. All you have to do is this:



            TCPDF 1st page Missing on Import Page
            Asked 2022-Feb-12 at 15:06

            When I try to import a pdf from an existing pdf it removes the first page and starts from the second. where am I going wrong



            Answered 2022-Feb-12 at 15:06
                $pdf = new TcpdfFpdi('P', 'mm', 'A4', true, 'UTF-8', false, true);
               $pages = $pdf->setSourceFile($this->file->path());
                 for ($i=1; $i<=$pages; $i++)
                       $tplIdx = $pdf->importPage($i);
                       $pdf->useTemplate($tplIdx, 0, 0, '210','297');
                $pdf->Output(public_path('filename'.pdf'), 'F');



            How to print (thermal 58) starting from the top position using TCPDF PHP
            Asked 2022-Feb-05 at 13:44

            I'm trying to create an invoice using php (tcpdf), but the results from the thermal (58 print) format always appear in the middle position.

            How to make print from top position ?

            Example Code :



            Answered 2022-Feb-05 at 13:44

            Dont try to print unitless PDF to a thermal printer, you will be attempting to send a Page Language to an esc/POS rolling 203 DPI printer that has variable lengths by using a roll cutter. IF you must use PDF ensure the content is matched to the roll width and cut length (harder done than said) @ the correct pixel resolution in monochrome and you may still often get castellated aliased graphics.

            Your key issue is the page is defined for that printout as 128 inches high (1 full page height = 1 roll length) thus you need a format and driver that is not designed for pages.

            For the Zj printers there are Cups system alternate driver at or and the manufacturer supplies a multi windows version XP to 10 driver for use with the printer.

            Normally I would recommend using SeaGull BarTender for Windows USB thermal printing but that model is not clearly supported

            Idealy you should use the printers own variant of esc/POS thermal language as instantly runs text or esc/POS binary through the port direct, not PDF through a much slower system driver with a PDF translation into monochrome escodes/text/bitmap stream for slow spooling. The printer stream will NOT be a %PDF- it will look at the start somthing like



            Send pdf output as stringAttachment using PHPMailer
            Asked 2022-Jan-04 at 14:08

            I am trying to attach a file using the PHPMailer's addStringAttachment method.

            I generated the pdf from TCPDF using:



            Answered 2022-Jan-04 at 13:57

            You don't show the code you're using, but that string is a fragment of an email message, not a PDF binary PDF string as it should be.

            Your code should be along the lines of (I don't remember tcpdf's syntax offhand):



            TCPDF: why "generate pdf" button shows the same data even when different cell's button is clicked?
            Asked 2021-Dec-21 at 11:00

            I am displaying data using DataTable, each cell has "Edit, Delete, Generate PDF". Functions of Add, Edit and Delete using Ajax are working fine. The "Generate PDF" when clicked, it opens in a new tab with data of the clicked cell's button. However, when I click on the other buttons it always show the data of the first cell, even though the URL contains that cell's id

            How can I transfer data to PDF based on the button click?



            Answered 2021-Dec-21 at 11:00

            You are not passing the variable to the PDF generator PHP file and also, in PDF generation file $row['id'] is not used, that is the reason you are getting the same data.

            Change in few places will make things work as expected.

            Pass the $row['id'] value to the php file.



            Is there any way to dynamically create new page in php TCPDF library with respect to an array with values
            Asked 2021-Dec-07 at 07:41

            I'm just stuck in this new problem in which I have to create a recommendation for a user's pet with a help of the PHP TCPDF library, In this situation, I have a form in which a user enters numbers of pets and their details.

            The problem is I don't know how many numbers of pets a user have and I can't use a loop inside a TCPDF library. As I want to create a new page or new PDF for every single pet details user has.

            Basically, i want to replace a variable inside $html = <<



            Answered 2021-Dec-07 at 07:41

            You can use your loop with AddPage(); method like:



            TCPDF unable to output file by saving. Path on Mac?
            Asked 2021-Nov-28 at 20:21

            I checked some similar questions here, but i didn't got an answer, solving my problem.

            I use TCPDF to generate a PDF with PHP.

            When I use the $pdf->Output($file_total, 'I'); it's all good and the file is shown in Browser.

            If I use the save to localhost option $pdf->Output($file_total, 'F'); I get this error:

            "failed to open stream: Permission denied in /opt/lampp/htdocs/project/tcpdf_min/include/tcpdf_static.php on line 1821" "TCPDF ERROR: Unable to create output file"

            The Path I set for saving the PDF file is: "/opt/lampp/htdocs/project/files/2021"

            What am I doing wrong? is my path wrong?

            The forced saving $pdf->Output($file_total, 'D'); works just fine, so i must doing something wrong with the path on mac... please help!




            Answered 2021-Nov-28 at 20:21

            In comments we both went through possible reasons such as finding an absolute rather than relative location and checking out folder permissions for non admin process as that was also suspected. Thus between us the conclusion was:-

            use address as


            and ensure target folder was set to permissions

            "read/write" for all users

            For production use the write access needs to be trimmed back to the process and admin, not all users.



            get root folder in each php file
            Asked 2021-Oct-11 at 11:35

            I have a include issue which I can't solve alone.

            This is my folder structure:

            for better explanation: There is a main folder "inc" (outside from accounting) and a subfolder inc (inset from accounting)

            in the subfolder "inc" is a functions.php which has the following line:



            Answered 2021-Oct-11 at 11:35

            Don't use relative paths for include. Relative paths have the "current working directory" as a reference. The working directory is not fixed and can also be changed by code. Always use the constant


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install TCPDF

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.


            Nicola Asuni
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone tecnickcom/TCPDF

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link