Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started

tecnickcom/tcpdf 6.6.4

TCPDF is a PHP class for generating PDF documents and barcodes.
Package summary
Share
0
issues
0
licenses
Package created
12 Sep 2015
Version published
6 Sep 2023
Maintainers
1
Total deps
0
Direct deps
0
License
LGPL-3.0-or-later
Error Generating Report

Frequently Asked Questions

What does tecnickcom/tcpdf do?

Tecnickcom/TCPDF is a PHP library designed to generate PDF documents on-the-fly, meaning it creates these documents as needed, rather than in a batch process. Apart from generating regular PDF documents, this versatile library also specializes in creating a variety of 1D and 2D barcodes. It supports all standard page formats and custom margins, as well as UTF-8 Unicode and Right-to-Left languages. Uniquely, it doesn't require any external libraries for the basic functions, offering programmers a seamless and independent solution for PDF generation. Additionally, it offers a myriad of features, such as page compression, document encryption up to 256 bit, digital signature certifications, bookmarks, image support, text rendering modes, multiple columns mode, and many more.

How do you use tecnickcom/tcpdf?

Using TCPDF to generate a PDF document is quite straightforward. Your first step is to install it via Composer on a command line by using composer require tecnickcom/tcpdf. After this, you can use it in your PHP file by including the TCPDF namespace at the top of your file and then initiating a new TCPDF object. Here's a simple usage example in PHP:

<?php
require_once('path_to/vendor/autoload.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Your Name');
$pdf->SetTitle('TCPDF Example');
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->setFooterData(array(0,64,0), array(0,64,128));
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setFontSubsetting(true);
$pdf->SetFont('dejavusans', '', 14, '', true);
$pdf->AddPage();
$html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org">www.tcpdf.org</a></h1>
<i>This is the first example of TCPDF library.</i>
EOD;
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$pdf->Output('example.pdf', 'I');
?>

In this example, we're generating a simple one-page PDF document that contains a header reading "Welcome to www.tcpdf.org" and a subheader of "This is the first example of TCPDF library.".

Where are the tecnickcom/tcpdf docs?

The official documentation for the tecnickcom/tcpdf package can be found at its official website, www.tcpdf.org, where it offers a comprehensive explanation of all its features and methods alongside with numerous examples of use, which can be beneficial for both beginners and advanced users. It also provides important notes for developers and licensing information. For source code, bug tracking, and version control, you can visit its Github repository.