Official clone of PHP library to generate PDF documents and barcodes

Related tags

PDF TCPDF
Overview

TCPDF

PHP PDF Library

Donate via PayPal Please consider supporting this project by making a donation via PayPal

IMPORTANT

A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable.

Description

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

Main Features:

  • no external libraries are required for the basic functions;
  • all standard page formats, custom page formats, custom margins and units of measure;
  • UTF-8 Unicode and Right-To-Left languages;
  • TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts;
  • font subsetting;
  • methods to publish some XHTML + CSS code, Javascript and Forms;
  • images, graphic (geometric figures) and transformation methods;
  • supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php)
  • 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417;
  • JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies;
  • automatic page header and footer management;
  • document encryption up to 256 bit and digital signature certifications;
  • transactions to UNDO commands;
  • PDF annotations, including links, text and file attachments;
  • text rendering modes (fill, stroke and clipping);
  • multiple columns mode;
  • no-write page regions;
  • bookmarks, named destinations and table of content;
  • text hyphenation;
  • text stretching and spacing (tracking);
  • automatic page break, line break and text alignments including justification;
  • automatic page numbering and page groups;
  • move and delete pages;
  • page compression (requires php-zlib extension);
  • XOBject Templates;
  • Layers and object visibility.
  • PDF/A-1b support.

Third party fonts:

This library may include third party font files released with different licenses.

All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3), they do not contain any binary data but just a description of the general properties of a particular font. These files can be also generated on the fly using the font utilities and TCPDF methods.

All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files).

The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3). The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license. For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503 Link : http://www.gnu.org/software/freefont/

The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection. For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33 Link : http://dejavu-fonts.org

The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2). Link : http://projects.arabeyes.org/

ICC profile:

TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package: https://packages.debian.org/source/stable/icc-profiles-free

Developer(s) Contact

Comments
  • PHP 8 deprecations

    PHP 8 deprecations

    PHP Deprecated:  Required parameter $currentfont follows optional parameter $isunicode in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 1998
    
    Deprecated: Required parameter $currentfont follows optional parameter $isunicode in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 1998
    PHP Deprecated:  Required parameter $currentfont follows optional parameter $isunicode in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2024
    
    Deprecated: Required parameter $currentfont follows optional parameter $isunicode in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2024
    PHP Deprecated:  Required parameter $currentfont follows optional parameter $setbom in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2040
    
    Deprecated: Required parameter $currentfont follows optional parameter $setbom in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2040
    PHP Deprecated:  Required parameter $currentfont follows optional parameter $setbom in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2060
    
    Deprecated: Required parameter $currentfont follows optional parameter $setbom in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2060
    PHP Deprecated:  Required parameter $currentfont follows optional parameter $str in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2077
    
    Deprecated: Required parameter $currentfont follows optional parameter $str in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2077
    PHP Deprecated:  Required parameter $currentfont follows optional parameter $str in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2093
    
    Deprecated: Required parameter $currentfont follows optional parameter $str in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2093
    PHP Deprecated:  Required parameter $tagvspaces follows optional parameter $default_css in vendor/tecnickcom/tcpdf/include/tcpdf_static.php on line 1139
    
    Deprecated: Required parameter $tagvspaces follows optional parameter $default_css in vendor/tecnickcom/tcpdf/include/tcpdf_static.php on line 1139
    PHP Deprecated:  Required parameter $k follows optional parameter $points in vendor/tecnickcom/tcpdf/include/tcpdf_static.php on line 2510
    
    

    https://travis-ci.org/github/phpmyadmin/phpmyadmin/jobs/682827038#L347

    opened by williamdes 44
  • Test suite

    Test suite

    A test suite runner and run comparator that is written in PHP for portability over different operating systems.

    @group annotations have been added to the example files to be able to target specific ones to run.

    I needed this script to run the tests under Windows to fix an issue with TCPDF under PHP8,1 (this will be a separate PR)

    Tested on Windows 10 with the following versions of PHP:

    • 5.3.29
    • 5.4.44
    • 5.5.38
    • 5.6.40
    • 7.0.10
    • 7.1.15
    • 7.2.28
    • 7.3.15
    • 7.4.33
    • 8.0.25
    • 8.1.12
    opened by jausions 14
  • image files are deleted after pdf has been rendered

    image files are deleted after pdf has been rendered

    hello,

    we have a serious issue since the update to version 6.3.0. we have two static images that we include in the header. when the pdf is rendered they are deleted from the filesystem. so every new pdf does not have these files anymore. i tracked this down to this commit: https://github.com/tecnickcom/TCPDF/commit/b41a5ca3114c18214ec2871fb68923e6d7bb9e92

    the images are added in this way:

    $this->resourceDirectory = getcwd() . '/data/content/';
    $this->Image($this->resourceDirectory . 'image.png', 371, 60, 164, 60, '', '', 'T');
    

    and then in _destroy() they are deleted from the filesystem. how can we avoid the deletion of these files?

    opened by BigMichi1 14
  • TCPDF ERROR: Unable to encrypt the file: /tmp/....

    TCPDF ERROR: Unable to encrypt the file: /tmp/....

    I'm getting the error

    "TCPDF ERROR: Unable to encrypt the file: /tmp/__tcpdf_da2bc8875a6a06c6630614ae3886e0bb_key_b35ba05eabe95b7419PhNUTd"

    when trying to encrypt my PDF using:

    $pdf->SetProtection(array('modify'), '12345678', null, 1, array(array('c' => 'file://var/www/tcpdf.crt', 'p' => array('modify'))));

    • File /var/www/tcpdf.crt exists and it's readable
    • Tried empty password and/or master passwd with no success

    When trying only the password protected feature it works correctly but it doesn't when adding the encryption part

    tcpdf.crt was generated running:

    # openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt

    I don't find what's wrong... Any suggestions? (there's no extra information in the logs and it seems there's no option to increase the debug level in TCPDF)

    opened by elg0ch0 13
  • Fix garbage collection

    Fix garbage collection

    When registering a shutdown function referencing to the tcpdf instance, it prevents this instance to be garbage collected. The desctructor call destroy(true) so the destruction result should be the same, but the object will be destroyed once it is not referenced anymore.

    opened by deguif 10
  • fix Undefined property: GLPIPDF::$imagekeys

    fix Undefined property: GLPIPDF::$imagekeys

      *** PHP Notice(8): Undefined property: GLPIPDF::$imagekeys
      *** PHP Warning(2): Invalid argument supplied for foreach()
    
    

    P.S. GLPIPDF is a simple class extending TCDPF https://github.com/glpi-project/glpi/blob/9.4/bugfixes/inc/glpipdf.class.php#L42

    opened by remicollet 10
  • PHP 8.1: Fix implicit conversion from float to int

    PHP 8.1: Fix implicit conversion from float to int

    Fixes PHP 8.1 deprecation notice: Implicit conversion from float to int loses precision.

    PHP Deprecated:  Implicit conversion from float 1.1768666666666663 to int loses precision in /home/runner/work/phpmyadmin/phpmyadmin/vendor/tecnickcom/tcpdf/tcpdf.php on line 4179
    PHP Deprecated:  Implicit conversion from float 1.1768666666666663 to int loses precision in /home/runner/work/phpmyadmin/phpmyadmin/vendor/tecnickcom/tcpdf/tcpdf.php on line 4180
    
    opened by MauricioFauth 9
  • PHP 8 compatible release

    PHP 8 compatible release

    When do you plan to tag a new release which contains the fixes for PHP 8 in dev-main? TCPDF is the last package that prevents us from fully supporting PHP 8 at the moment.

    opened by aimeos 9
  • Fixing warning + using cache

    Fixing warning + using cache

    2015-09-01T10:58:53+02:00 WARN (4): exception 'ErrorException' with message '

    MSG: getimagesize(D:\wap\htdocs\lisp.prestagroup.com\data\cache\tcpdf__tcpdf_imgmask_plain_d2936e64b83af2c88602d2e6f0aa065a): failed to open stream: No such file or directory

    ' in D:\wap\htdocs\lisp.prestagroup.com\vendor\tecnick.com\tcpdf\tcpdf.php:6894 Stack trace: #0 [internal function]: Logger\Logger::Logger{closure}(2, 'getimagesize(D:...', 'D:\wap\htdocs\l...', 6894, Array) #1 D:\wap\htdocs\lisp.prestagroup.com\vendor\tecnick.com\tcpdf\tcpdf.php(6894): getimagesize('D:\wap\htdocs\l...') #2 D:\wap\htdocs\lisp.prestagroup.com\vendor\tecnick.com\tcpdf\tcpdf.php(7049): TCPDF->Image('D:\wap\htdocs\l...', 188.90909090909, 108.44436066667, 6, 6, '', '', 'L', false, 300, '', false, 2)

    opened by ThaDafinser 9
  • Fix a warning for PHP 7.4

    Fix a warning for PHP 7.4

    Environments

    • PHP 7.4.0 alpha 1
    • TCPDF 6.2.26

    Issue

    The constructor of TCPDF causes a warning in PHP 7.4 (currently still under dev). It's fine in 7.3 and former versions.

    Warning: chr() expects parameter 1 to be int, string given in C:\Users\Clover\Desktop\test\php\vendor\tecnickcom\tcpdf\include\tcpdf_fonts.php on line 1671
    

    Traceback

    https://github.com/tecnickcom/TCPDF/blob/756908329d3ebf553d069f0dfede7a81a8229a4e/include/tcpdf_fonts.php#L1666

    https://github.com/tecnickcom/TCPDF/blob/756908329d3ebf553d069f0dfede7a81a8229a4e/include/tcpdf_fonts.php#L1803

    https://github.com/tecnickcom/TCPDF/blob/756908329d3ebf553d069f0dfede7a81a8229a4e/include/tcpdf_fonts.php#L2099

    https://github.com/tecnickcom/TCPDF/blob/756908329d3ebf553d069f0dfede7a81a8229a4e/tcpdf.php#L1963

    I don't see a reason why it's called with TCPDF_FONTS::utf8Bidi(array(''), '', false, $this->isunicode, $this->CurrentFont); rather than TCPDF_FONTS::utf8Bidi(array(), '', false, $this->isunicode, $this->CurrentFont);.

    Reproducer

    <?php
    
    declare(strict_types=1);
    
    require __DIR__ . '/vendor/autoload.php';
    
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf->AddPage();
    $pdf->writeHTMLCell(0, 0, '', '', 'Hello World', 0, 1, 0, true, '', true);
    $pdf->Output(__DIR__ . '/example_001.pdf', 'F');
    
    opened by jfcherng 8
  • "Non well formed numeric value" error occurs in PHP 7

    The $size variable in the SetFontSize function is supposed to be a float type, but a string can be passed in like "14px" causing an error in PHP 7. Re-casting the variable is a simple solution to fix the variable type if it was incorrectly passed in.

    opened by csears123 8
  • How to add a file into the PDF, without adding annotation?

    How to add a file into the PDF, without adding annotation?

    Hello,

    To create an invoice, using the factur-x format, I need to embed an XML file into the PDF. The only way, i've founded was to add an annotation:

    $pdf->Annotation(0,0,0,0, 'invoice', array(
        'Subtype' => 'FileAttachment', 
        'Name'    => 'PushPin', 
        'FS'      => 'factur-x.xml'
    ));
    

    But:

    1. that adds an useless annotation
    2. the file appears twice (in the file list) when I open the PDF with Accrobat Reader

    Is there a way to simply add the file, without annotation?

    Thx Th.

    opened by thierryler 5
  • CSS empty-cells Property and :not(:empty) Property not working

    CSS empty-cells Property and :not(:empty) Property not working

    I'm trying to use these properties to change the background color if is filled, got two methods but both didn't work, Please help if I'm doing something wrong or any suggestion will be helpful

    Captureimg Capturecode

    opened by AnkitPatel-git 0
  • Extract method to get TCPDF producer

    Extract method to get TCPDF producer

    Wraps TCPDF_STATIC::getTCPDFProducer() calls with a private method and adds an empty private property that can be used to change the producer line. The private property can be changed with the reflection API.

    Both method and property are declared as private to avoid BC breaks.

    The idea is to help with testing PDF generation, by using a predictable producer line.

    • Related to https://github.com/tecnickcom/TCPDF/pull/85
    opened by MauricioFauth 1
  • Hebrew language words are not working for SVG Image loaded to the PDF

    Hebrew language words are not working for SVG Image loaded to the PDF

    Hello, I am generating a PDF with an SVG background image. where some of the text is in the Hebrew language. The generated PDF is showing question marks "?" where I have added the Hebrew texts. $pdf->ImageSVG('@'.$svg_data, 0, 0, '', '', '', '', '', false, 300, '', false, false, 0); I tried adding language files in the font directory but it didn't work.

    opened by Jeet-Naik 0
Owner
Tecnick.com LTD
Open Source Software
Tecnick.com LTD
Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using Gravity Forms.

Gravity PDF Gravity PDF is a GPLv2-licensed WordPress plugin that allows you to automatically generate, email and download PDF documents using the pop

Gravity PDF 90 Nov 14, 2022
FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF.

FPDI - Free PDF Document Importer ❗ This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. ❗ FPDI is a collection of

Setasign 821 Jan 4, 2023
Magento 2 Invoice PDF Generator - helps you to customize the pdf templates for Magento 2

Magento 2 Invoice PDF Generator - helps you to customize the pdf templates for Magento 2. If you have an enabled template and a default template for the store you need your template the system will print the pdf template.

EAdesign 64 Oct 18, 2021
Generate simple PDF invoices with PHP

InvoiScript Generate simple PDF invoices with PHP. Installation Run: composer require mzur/invoiscript Usage Example use Mzur\InvoiScript\Invoice; re

Martin Zurowietz 16 Aug 24, 2022
Generate pdf file with printable labels

printable_labels_pdf Generate pdf file with printable labels with PHP code. CREATE A PDF FILE WITH LABELS EASELY: You can get a pdf file with labels f

Rafael Martin Soto 5 Sep 22, 2022
Generate PDF invoices for your customers in laravel

What is Invoices? Invoices is a Laravel library that generates a PDF invoice for your customers. The PDF can be either downloaded or streamed in the b

Erik C. Forés 399 Jan 2, 2023
Rapidly Generate Simple Pdf, CSV, & Excel Report Package on Laravel

Laravel Report Generators (PDF, CSV & Excel) Rapidly Generate Simple Pdf Report on Laravel (Using barryvdh/laravel-dompdf or barryvdh/laravel-snappy)

Jimmy Setiawan 513 Dec 31, 2022
Pdf and graphic files generator library written in php

Information Examples Sample documents are in the "examples" directory. "index.php" file is the web interface to browse examples, "cli.php" is a consol

Piotr Śliwa 335 Nov 26, 2022
PHP library generating PDF files from UTF-8 encoded HTML

mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancement

null 3.8k Jan 2, 2023
PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Snappy Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. It uses the excellent webkit-based wkhtmltopd

KNP Labs 4.1k Dec 30, 2022
TCPDF - PHP PDF Library - https://tcpdf.org

tc-lib-pdf PHP PDF Library UNDER DEVELOPMENT (NOT READY) UPDATE: CURRENTLY ALL THE DEPENDENCY LIBRARIES ARE ALMOST COMPLETE BUT THE CORE LIBRARY STILL

Tecnick.com LTD 1.3k Dec 30, 2022
PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.

PdfParser Pdf Parser, a standalone PHP library, provides various tools to extract data from a PDF file. Website : https://www.pdfparser.org Test the A

Sebastien MALOT 1.9k Jan 2, 2023
PHP library allowing PDF generation or snapshot from an URL or an HTML page. Wrapper for Kozea/WeasyPrint

PhpWeasyPrint PhpWeasyPrint is a PHP library allowing PDF generation from an URL or an HTML page. It's a wrapper for WeasyPrint, a smart solution help

Pontedilana 23 Oct 28, 2022
PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page.

Snappy Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. It uses the excellent webkit-based wkhtmltopd

KNP Labs 4.1k Dec 30, 2022
A PHP tool that helps you write eBooks in markdown and convert to PDF.

Artwork by Eric L. Barnes and Caneco from Laravel News ❤️ . This PHP tool helps you write eBooks in markdown. Run ibis build and an eBook will be gene

Mohamed Said 1.6k Jan 2, 2023
A PDF conversion and form utility based on pdftk

php-pdftk A PDF conversion and form utility based on pdftk. Features php-pdftk brings the full power of pdftk to PHP - and more. Fill forms, either fr

Michael Härtl 800 Jan 9, 2023
HTML to PDF converter for PHP

Dompdf Dompdf is an HTML to PDF converter At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is

null 9.3k Jan 1, 2023
Convert HTML to PDF using Webkit (QtWebKit)

wkhtmltopdf and wkhtmltoimage wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF and various image formats using the QT Webk

wkhtmltopdf 13k Jan 4, 2023
Convert html to an image, pdf or string

Convert a webpage to an image or pdf using headless Chrome The package can convert a webpage to an image or pdf. The conversion is done behind the sce

Spatie 4.1k Jan 1, 2023