1. Products
  2.   PDF
  3.   PHP
  4.   PHPPdf
 
  

Transform XML Documents to PDF via PHP Library 

Open Source PHP API to Generate, Edit, and Process PDF Documents, Add Barcode, Charts, Tables, Headers & Footers, and Bookmarks to PDF Files.

PHPPdf library has provided the capability to transform your XML documents to a PDF document or graphics files inside your own application without any external dependencies. Using the PHP PDF Library programmers can easily create custom PDF apps supporting a set of extraordinary features with very few lines of PHP code.

PHPPdf help developers to build their own powerful PDF converter in minimum cost and effort. Several important features related to PDF creation and manipulation is fully supported by the library such as generate PDF files from the scratch, Barcode support in PDFs, drawing simple charts, external and internal hyperlinks support, bookmarks creation support,  adding sticky notes, headers and footers support, adding watermark, breaking pages & columns, metadata and many more.

The PHPPdf library has also included support for defining style-sheets. You can easily define your style-sheets in an external file and can include short as well as long declarations of attributes. It also supports color palettes that give users the ability to create or overwrite default named colors.

.

Previous Next

Getting Started with PHPPdf

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

Install PHPPdf via composer

$ composer require psliwa/php-pdf

PDF Files Creation from XML via PHP API

PHPPdf library allows software developers to create PDF documents by transforming an XML document inside their own PHP applications. The library supports UTF-8 encoding and has provided some free fonts for this purpose. You can easily set page size using standard predefined values like legal, letter, A4, etc. as well can set custom page dimensions. You can also define font type, size, and styles like normal, bold, italic, bold-italic, light, or light-italic with ease.

Parse Document to Create PDF via PHP

 //register the PHPPdf and vendor (Zend_Pdf and other dependencies) autoloaders
require_once 'PHPPdf/Autoloader.php';
PHPPdf\Autoloader::register();
PHPPdf\Autoloader::register('/path/to/library/lib/vendor/Zend/library');

//if you want to generate graphic files
PHPPdf\Autoloader::register('sciezka/do/biblioteki/lib/vendor/Imagine/lib');

$facade = new PHPPdf\Core\Facade(new PHPPdf\Core\Configuration\Loader());

//$documentXml and $stylesheetXml are strings contains XML documents, $stylesheetXml is optional
$content = $facade->render($documentXml, $stylesheetXml);

header('Content-Type: application/pdf');
echo $content;

Add Headers & Footers to PDF File

The headers and footers are the top and bottom sections of a PDF that gives a professional look to PDF documents. To make longer PDF documents organized and easier to read developers can use Headers and footers section of a PDF document.  The PHPPdf has included support for adding headers & footers to PDF documents. It supports features like adding repetitive header/footer, insert images in a header/footer, add page numbers, and much more.

Barcode Supports in PDF Files via PHP

The headers and footers are the top and bottom sections of a PDF that gives a professional look to PDF documents. To make longer PDF documents organized and easier to read developers can use the Headers and footers section of a PDF document. The PHPPdf supports adding headers & footers to PDF documents. It supports features like adding repetitive header/footer, inserting images in a header/footer, adding page numbers, and much more.

Extract Metadata from PDF Document

PHPPdf library gives software developers the power to read & extract metadata from a PDF document via PHP. Metadata includes very important information about the PDF document. The library supports metadata like Creator, Keywords, Subject, Author, Title, ModDate, CreationDate, and Trapped.

 
 English