PHP Library for PDF Document Creation & Editing

Open Source PHP API to Generate PDF documents, Font subletting, JPEG or PNG and SVG images Native support, 1D and 2D Barcodes support.

The TCPDF is an open source PHP library that gives software developers the capability to generate PDF documents using PHP commands without any external dependencies. The great thing about TCPDF is that it is considered to be the only PHP-based library that includes complete support for UTF-8 Unicode and right-to-left languages.

The library supports several important features such as creating PDF documents, font subletting, images & graphic support, native support for JPEG, PNG and SVG images, 1D and 2D barcode support, manage PDF page header and footer, encryption and decryption support, PDF annotations, table of content, text rendering modes, custom page formats, custom margins, page units and much more.

The library is considered to be one of the most popular and the most used PHP libraries in the world because it has been included in the most popular PHP-based CMS and applications, including Joomla, Drupal, Moodle, phpMyAdmin, and so on.

Previous Next

Getting Started with TCPDF

TCPDF is available at, so you can use the composer to download this library and all dependencies. Please use the following command for a smooth installation.

Install TCPDF Command

 Install Package TCPDF

Generate PDF Documents using PHP Library

The free PHP library TCPDF has included the functionality that enables software programmers to programmatically create PDF documents inside their own PHP applications. You can use utf-8 encoding as well as support for Right-To-Left languages. Several important features like selecting font type and size, custom margins, units of measure, add barcode, add a table, insert pages, move the page, delete pages, and much more.

Barcode Supports in PDF Files via PHP

The open source PHP library provides functionality for including Barcode inside PDF documents using a couple of lines of PHP code. Developers can use different types of 1D Barcode (CODE 39, CODE 128 AUTO, EAN 8, UPC-E, MSI, CODABAR, CODE 11, RMS4CC) and 2D Barcodes (QR-Code, Datamatrix ECC200, and PDF417) with ease. It also provides supports for features like setting Barcode height, Barcode alignment, set margins, apply checksum, & more.

Add Custom Headers/Footers in PDF

The Headers and footers are useful parts of a PDF document that helps users to organize their PDF files as well as easier to read. The open source library TCPDF makes developer’s jobs easy by including functionality for adding custom headers & footers to PDF documents with just a couple of lines of PP code. It supports features like set fonts for headers and footers, set margins, auto page breaks, add images inside header/footer, add page numbers, and soon.

Create a Table of Contents

The open source PHP library TCPDF provides functionality for creating a table of contents inside their own applications. The uses of Table of Contents help readers to understand the structure of the documents and can quickly find the information they are looking for. To create a Table of contents you need to add a new page for TOC and can write the TOC title and/or other elements on the TOC page. You can also define styles for various bookmark levels for various HTML elements with ease.