A PDF conversion and form utility based on pdftk

Related tags

PDF php-pdftk
Overview

php-pdftk

GitHub Tests Packagist Version Packagist Downloads GitHub license Packagist PHP Version Support

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 from a XFDF/FDF file or from a data array (UTF-8 safe for unflattened forms, requires pdftk 2.x !)
  • Create XFDF or FDF files from PHP arrays (UTF-8 safe!)
  • Create FDF files from filled PDF forms
  • Combine pages from several PDF files into a new PDF file
  • Split a PDF into one file per page
  • Add background or overlay PDFs
  • Read out meta data about PDF and form fields
  • Set passwords and permissions
  • Remove passwords

Requirements

  • The pdftk command must be installed and working on your system
  • This library is written for pdftk 2.x versions. You should be able to use it with pdftk 1.x but not all methods will work there. For details consult the man page of pdftk on your system.
  • There is a known issue on Ubuntu if you installed the pdftk package from snap. This version has no permission to write to the /tmp directory. You can either set another temporay directory as described below or use another package. For Ubuntu 18.10 there's also a pdftk-java package available via apt which should work fine. You can also install this package on Ubuntu 18.04 if you download it manually. Also check this answer on askubuntu.

Note: The pdftk version from the alternative PPA ppa:malteworld/ppa is no longer available. The author instead now points to his answer on askubuntu linked above.

Installation

You should use composer to install this library.

composer require mikehaertl/php-pdftk

Examples

Create instance for PDF files

There are several ways to tell the Pdf instance which file(s) it should use. Some files may also require a password or need an alias to be used as a handle in some operations (e.g. cat or shuffle).

Note: In version 2.x of pdftk a handle can be one or more upper case letters.

// Create an instance for a single file
$pdf = new Pdf('/path/to/form.pdf');

// Alternatively add files later. Handles are autogenerated in this case.
$pdf = new Pdf();
$pdf->addFile('/path/to/file1.pdf');
$pdf->addFile('/path/to/file2.pdf');

// Add files with own handle
$pdf = new Pdf();
$pdf->addFile('/path/to/file1.pdf', 'A');
$pdf->addFile('/path/to/file2.pdf', 'B');
// Add file with handle and password
$pdf->addFile('/path/to/file3.pdf', 'C', 'secret*password');

// Shortcut to pass all files to the constructor
$pdf = new Pdf([
  'A' => ['/path/to/file1.pdf', 'secret*password1'],
  'B' => ['/path/to/file2.pdf', 'secret*password2'],
]);

Operations

Please consult the pdftk man page for each operation to find out how each operation works in detail and which options are available.

For all operations you can either save the PDF locally through saveAs($name) or send it to the browser with send(). If you pass a filename to send($name) the client browser will open a download dialogue whereas without a filename it will usually display the PDF inline.

IMPORTANT: You can always only perform one of the following operations on a single PDF instance. Below you can find a workaround if you need multiple operations.

Fill Form

Fill a PDF form with data from a PHP array or an XFDF/FDF file.

use mikehaertl\pdftk\Pdf;

// Fill form with data array
$pdf = new Pdf('/full/path/to/form.pdf');
$result = $pdf->fillForm([
        'name'=>'ÄÜÖ äüö мирано čárka',
        'nested.name' => 'valX',
    ])
    ->needAppearances()
    ->saveAs('filled.pdf');

// Always check for errors
if ($result === false) {
    $error = $pdf->getError();
}

// Fill form from FDF
$pdf = new Pdf('form.pdf');
$result = $pdf->fillForm('data.xfdf')
    ->saveAs('filled.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Note: When filling in UTF-8 data, you should always add the needAppearances() option. This will make sure, that the PDF reader takes care of using the right fonts for rendering, something that pdftk can't do for you. Also note that flatten() doesn't really work well if you have special characters in your data.

Create a XFDF/FDF file from a PHP array

This is a bonus feature that is not available from pdftk.

use mikehaertl\pdftk\XfdfFile;
use mikehaertl\pdftk\FdfFile;

$xfdf = new XfdfFile(['name' => 'Jürgen мирано']);
$xfdf->saveAs('/path/to/data.xfdf');

$fdf = new FdfFile(['name' => 'Jürgen мирано']);
$fdf->saveAs('/path/to/data.fdf');

Cat

Assemble a PDF from pages from one or more PDF files.

use mikehaertl\pdftk\Pdf;

// Extract pages 1-5 and 7,4,9 into a new file
$pdf = new Pdf('/path/to/my.pdf');
$result = $pdf->cat(1, 5)
    ->cat([7, 4, 9])
    ->saveAs('/path/to/new.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Combine pages from several files
$pdf = new Pdf([
    'A' => '/path/file1.pdf',                 // A is alias for file1.pdf
    'B' => ['/path/file2.pdf','pass**word'],  // B is alias for file2.pdf
    'C' => ['/path/file3.pdf','secret**pw'],  // C is alias for file3.pdf
]);
$result = $pdf->cat(1, 5, 'A')                // pages 1-5 from A
    ->cat(3, null, 'B')             // page 3 from B
    ->cat(7, 'end', 'B', null, 'east') // pages 7-end from B, rotated East
    ->cat('end',3,'A','even')       // even pages 3-end in reverse order from A
    ->cat([2,3,7], 'C')             // pages 2,3 and 7 from C
    ->saveAs('/path/new.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Shuffle

Like cat() but create "streams" and fill the new PDF with one page from each stream at a time.

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf([
    'A' => '/path/file1.pdf',     // A is alias for file1.pdf
    'B' => '/path/file2.pdf',     // B is alias for file2.pdf
]);

// new.pdf will have pages A1, B3, A2, B4, A3, B5, ...
$result = $pdf->shuffle(1, 5, 'A')    // pages 1-5 from A
    ->shuffle(3, 8, 'B')    // pages 3-8 from B
    ->saveAs('/path/new.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Burst

Split a PDF file into one file per page.

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf');
$result = $pdf->burst('/path/page_%d.pdf');     // Supply a printf() pattern
if ($result === false) {
    $error = $pdf->getError();
}

Add background PDF

Add another PDF file as background.

use mikehaertl\pdftk\Pdf;

// Set background from another PDF (first page repeated)
$pdf = new Pdf('/path/my.pdf');
$result = $pdf->background('/path/back.pdf')
    ->saveAs('/path/watermarked.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Set background from another PDF (one page each)
$pdf = new Pdf('/path/my.pdf');
$result = $pdf->multiBackground('/path/back_pages.pdf')
    ->saveAs('/path/watermarked.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Add overlay PDF

Add another PDF file as overlay.

use mikehaertl\pdftk\Pdf;

// Stamp with another PDF (first page repeated)
$pdf = new Pdf('/path/my.pdf');
$result = $pdf->stamp('/path/overlay.pdf')
    ->saveAs('/path/stamped.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Stamp with another PDF (one page each)
$pdf = new Pdf('/path/my.pdf');
$result = $pdf->multiStamp('/path/overlay_pages.pdf')
    ->saveAs('/path/stamped.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Attach Files

Add file attachments to the document or to a specific page.

use mikehaertl\pdftk\Pdf;

$files = [
    '/path/to/file1',
    '/path/to/file2',
]

// Add files at the document level
$pdf = new Pdf('/path/my.pdf');
$result = $pdf->attachFiles($files)
    ->saveAs('/path/withfiles.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Add files to a specific page
$pdf = new Pdf('/path/my.pdf');
$page = 7;
$result = $pdf->attachFiles($files, $page)
    ->saveAs('/path/withfiles.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Unpack Files

Copy file attachments from a PDF to the given directory.

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf');
$result = $pdf->unpackFiles('/path/to/dir');
if ($result === false) {
    $error = $pdf->getError();
}

Generate FDF

Create a FDF file from a given filled PDF form.

use mikehaertl\pdftk\Pdf;

// Create FDF from PDF
$pdf = new Pdf('/path/form.pdf');
$result = $pdf->generateFdfFile('/path/data.fdf');
if ($result === false) {
    $error = $pdf->getError();
}

Get PDF data

Read out metadata or form field information from a PDF file.

use mikehaertl\pdftk\Pdf;

// Get data
$pdf = new Pdf('/path/my.pdf');
$data = $pdf->getData();
if ($data === false) {
    $error = $pdf->getError();
}

// Get form data fields
$pdf = new Pdf('/path/my.pdf');
$data = $pdf->getDataFields();
if ($data === false) {
    $error = $pdf->getError();
}

// Get data as string
echo $data;
$txt = (string) $data;
$txt = $data->__toString();

// Get data as array
$arr = (array) $data;
$arr = $data->__toArray();
$field1 = $data[0]['Field1'];

How to perform more than one operation on a PDF

As stated above, you can only perform one of the preceeding operations on a single PDF instance. If you need more than one operation you can feed one Pdf instance into another:

use mikehaertl\pdftk\Pdf;

// Extract pages 1-5 and 7,4,9 into a new file
$pdf = new Pdf('/path/my.pdf');
$pdf->cat(1, 5)
    ->cat([7, 4, 9]);

// We now use the above PDF as source file for a new PDF
$pdf2 = new Pdf($pdf);
$result = $pdf2->fillForm(['name' => 'ÄÜÖ äüö мирано čárka'])
    ->needAppearances()
    ->saveAs('/path/filled.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Options

You can combine the above operations with one or more of the following options.

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf');

$result = $pdf->allow('AllFeatures')      // Change permissions
    ->flatten()                 // Merge form data into document (doesn't work well with UTF-8!)
    ->compress($value)          // Compress/Uncompress
    ->keepId('first')           // Keep first/last Id of combined files
    ->dropXfa()                 // Drop newer XFA form from PDF
    ->dropXmp()                 // Drop newer XMP data from PDF
    ->needAppearances()         // Make clients create appearance for form fields
    ->setPassword($pw)          // Set owner password
    ->setUserPassword($pw)      // Set user password
    ->passwordEncryption(128)   // Set password encryption strength
    ->saveAs('new.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Example: Fill PDF form and merge form data into PDF
// Fill form with data array
$result = $pdf = new Pdf('/path/form.pdf');
$pdf->fillForm(['name' => 'My Name'])
    ->flatten()
    ->saveAs('/path/filled.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

// Example: Remove password from a PDF
$pdf = new Pdf;
$result = $pdf->addFile('/path/my.pdf', null, 'some**password')
    ->saveAs('/path/new.pdf');
if ($result === false) {
    $error = $pdf->getError();
}

Shell Command

The class uses php-shellcommand to execute pdftk. You can pass $options for its Command class as second argument to the constructor:

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf', [
    'command' => '/some/other/path/to/pdftk',
    // or on most Windows systems:
    // 'command' => 'C:\Program Files (x86)\PDFtk\bin\pdftk.exe',
    'useExec' => true,  // May help on Windows systems if execution fails
]);

Temporary File

Internally a temporary file is created via php-tmpfile. You can also access that file directly, e.g. if you neither want to send or save the file but only need the binary PDF content:

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf');
$result = $pdf->fillForm(['name' => 'My Name'])
    ->execute();
if ($result === false) {
    $error = $pdf->getError();
}
$content = file_get_contents( (string) $pdf->getTmpFile() );

If you have permission issues you may have to set a directory where your pdftk command can write to:

use mikehaertl\pdftk\Pdf;

$pdf = new Pdf('/path/my.pdf');
$pdf->tempDir = '/home/john/temp';

API

Please consult the source files for a full documentation of each method.

Comments
  • Missing characters

    Missing characters

    Hello i am using part of your code. FfdfFile class with following code(only the part with characters):

       if ($directory === null) {
            $directory = sys_get_temp_dir();
        }
        $filename = $filename;
        $fields = '';
        foreach ($data as $key => $value) {
    
            $utf16Value = mb_convert_encoding($value,'UTF-16BE', $encoding);
    
            // Escape parenthesis
            $utf16Value = strtr($utf16Value, array('(' => '\\(', ')' => '\\)'));
            $fields .= "<</T($key)/V(" . chr(0xFE) . chr(0xFF) . $utf16Value . ")>>\n";
        }
    

    Problem is that some characters are missing like "čćđ", on the other hand there are "šž", which is nice but i need them all... I have tried few things but i can't quite get more characters working. If i open created .fdf file in notepad i can see an empty space where "č" should be. I am using .fdf file to fill out pdf and at the places with missing characters there is a blank spot..

    opened by Niproblema 49
  • Can not write to temp directory

    Can not write to temp directory

    Whenever I try to fill in a form using fillForm I get an error message stating Error: Failed to open form data file: \n /tmp/php_pdftk_xfdf_uL6Hf2.xfdf\n No output created. code: $tempPdf = new \mikehaertl\pdftk\Pdf(__DIR__ . '/Mededelingsformulier_scheiding_2019_2.pdf'); $tempPdf->fillForm($arr = [ 'test' => 'test', ]); $tempPdf->saveAs(__DIR__ . '/tempfile.pdf'); $error = $tempPdf->getError(); $this->assertEquals('', $error); All files are accessible, other functions work perfectly (getDataFileds, GenerateFdf) I'm working with Laravel running on an updated Homestead vagrant instance using pdftk from a snap install.

    opened by PaulusMenheere 27
  • How do I handle multi-select boxes

    How do I handle multi-select boxes

    Hi,

    I've seen some similar questions but none which help in my particular use-case. How do I handle groups of checkboxes which have the same name but multiple possible options for the user using the PHP Library?

    For example, say I have a list of animals in a PDF and the user ticks which ones they own:

    What pets do you have?
    * Dog (name: animals_select, export value: dog)
    * Cat (name: animals_select, export value: cat)
    * House Pig (name: animals_select, export value: house_pig)
    

    I was hoping I could pass multiple values through to the library like so:

    $pdf = new PDF("path/to/template.pdf");
    $pdf->fillForm(array(
       'user_name' => 'John Smith',
       'animals_select' => array(
          'dog',
          'house_pig
       )
    ));
    

    The ideal outcome being when we received the PDF, it would have the Dog and House Pig checkboxes ticked in that group.

    However, from looking at the XfdfFile.php file, it looks like I can only pass a single value for every form field on the page. So, I edited the file a little bit to accept arrays (it was previously failing on the sanitizing if it was an array) but although it reaches the writeFields() function properly formatted, the boxes still don't get ticked on the final PDF.

    Please could you point me in the right direction or let me know if this is something which isn't possible currently?

    For reference, here's what I changed on the writeFields() function to allow multiple values for the same key.

    protected function writeFields($fp, $fields, $recKey = false)
        {
            foreach ($fields as $key => $value) {
                if($recKey){
                  fwrite($fp, "<field name=\"$recKey\">\n<value>$value</value>\n</field>\n");
                } else if (is_array($value)) {
                  fwrite($fp, "<field name=\"$key\">\n");
                  $this->writeFields($fp, $value, $key);
                  fwrite($fp, "</field>\n");
                } else {
                  fwrite($fp, "<field name=\"$key\">\n<value>$value</value>\n</field>\n");
                }
            }
        }
    

    I feel like it should be working but I might be missing an easier way for the library to handle it, or I'm misunderstanding how multi-select boxes are handled in PDFs. Any advice on how to achieve this with your library would be greatly appreciated!

    opened by JackWillDavis 21
  • Bug/missing feature: updateInfo() cannot parse the data generated by getData()

    Bug/missing feature: updateInfo() cannot parse the data generated by getData()

    updateInfo() is the counter-part of getData() (pdftk commands ump_data and update_info):

     update_info <info data filename | - | PROMPT>
                     Changes the bookmarks and metadata in a single PDF's Info dictionary to match the input data file.
                     The input data file uses the same syntax as the output from dump_data.
    

    However, on the php-pdftk level updateInfo() is not able to parse the output of getData(). This was quite surprising. Of course, one can pass a suitably prepared file to updateInfo(), still it would be convenient if updateInfo() could just take the output of getData().

    Kind thanks for this nice piece of software, BTW!

    opened by rotdrop 16
  • Problem with nested fields with numeric field names

    Problem with nested fields with numeric field names

    I seem to have found a big issue with the newer version (0.10.3). I narrowed it down to issues with XFDF generator.

    See files generated by the two versions: xfdf.zip

    Version 0.10.3 generate files that don't work fully with pdftk-java (some fields are not filled).

    opened by maxguru 16
  • Rendering PDF File

    Rendering PDF File

    Hi,

    Is there a way to render the PDF file for download after combining/merging several PDF/DOC/DOCX files into one PDF file? Or is there any possible way to integrate pdftk with mpdf?

    Thank you. Kind regards.

    opened by sandy0201 16
  • FdfFile > Encode field name / key as UTF-16BE

    FdfFile > Encode field name / key as UTF-16BE

    Works same like the actual value. This allows field names containing german umlauts and most likely many other "special" characters

    Closes issue #17 (https://github.com/mikehaertl/php-pdftk/issues/17)

    opened by mcdope 15
  • Can't fill data after addFile operation

    Can't fill data after addFile operation

    I am having 2 fillable pdf file named abc.pdf and xyz.pdf. I am filling in detail in these PDFs with fillForm function and after filling details merging these file with addFile operation and saving it with name abcxyz.pdf

    Now when I am going to fill details in merged file abcxyz.pdf it is giving me error as shown below

    Warning: input PDF is not an acroform, so its fields were not filled.

    and data is not being filled in pdf.

    opened by dnp1891 13
  • Can't open PDF on my iPhone

    Can't open PDF on my iPhone

    Every time I try on my iPhone, I get an error message. I tried both send() and send('whatever.pdf'). None work. It works perfectly on Android and desktop browsers. Any Idea what might cause this issue?

    The script is here: https://www.die-partei-lichtenberg.de/mitgliedsantrag/

    img_1691

    Thanks in advance!

    opened by pboese 12
  • sh: pdftk: command not found

    sh: pdftk: command not found

    I did install pdftk server on my Mac and the pdftk command runs without problems on any folder.

    However, while using your tool, I got the error: sh: pdftk: command not found

    $pdf = new Pdf('t4.pdf'); $pdf->fillForm('t4_data.fdf') ->saveAs('T4filled.pdf'); var_dump($pdf->getError());

    Could you please help me with this?

    Thank you very much.

    opened by philipmustang 12
  • Not working on a standalone windows box

    Not working on a standalone windows box

    I'm using yii2 and xampp on a windows 7 home edition box and trying to fill pdf form using your php-pdftk extension which I've installed using composer. I've downloaded pdftk and installed it and the binaries libiconf2.dll and pdftk.exe are in C:\Program Files (x86)\PDFtk\bin\

    Here is my code in controller (same as the sample you provided with your extension)

    use mikehaertl\pdftk\Pdf;

    public function actionIndex() { // Fill form with data array $pdf = new Pdf('form.pdf'); $pdf->fillForm(array('name'=>'John Doe')) ->needAppearances() ->saveAs('filled.pdf'); }

    bu it does not work. Nothing happens, no errors, absolutely nothing! form.pdf file is in the webroot directory C:\xampp\htdocs\MyWebsite\form.pdf

    It seems, my php script cannot just find the pdftk binaries. I've tryed to put them in the vendor\bin directory of my yii2 template without any success. I don't know where to place the pdftk binaries for the extension to find then and/or whether there are any other configurations steps ( in other words, basic things) I have to do.

    You surely cannot have tested your extension in all possible environments but if you've tested it in a windows environment, please help me.

    Thanks in advance.

    windows-only 
    opened by mutyii 12
  • Argument with % is escaped

    Argument with % is escaped

    Hi, thank you for your amazing work. I used your library to split a large pdf into single pages. The method burst did not worked right away because the % character in the pattern was escaped and substituted with a white space in the processOptions function at line 213 of file command.php. So the output consisted of the last page only, as each page was overwriting the older. Changing the statement from $this->addArg('output', $filename, true); to $this->addArg('output', $filename, false); solved the problem. But probably It can cause other issues?

    opened by giaza 4
  • Failed to load resource.

    Failed to load resource.

    Im using pdftk and get an issue while im open the created pdf in safari (failed to load resource). Everything works fine on Chrome and Firefox. The problem starts while I started to use SSL.

    Safari starts to load the pdf, gets grey and then stops. The pdf menu (right click) is available.

    help wanted 
    opened by phkraehling 6
  • Example of creating Bookmarks for pdf merge

    Example of creating Bookmarks for pdf merge

    I know it's possible to making bookmarks with multiple pdf files merging via PDFtk direct. Is this possible via php-pdftk? If yes, can you do a small demo for me? For example, I have three (or more) pdf files, PDF1 is 4 pages, and PDF2 is 3 pages, and PDF3 is 2 Pages, is it possible to create the merged file with bookmarks indicated PDF2 is from Page5 (to Page7), and PDF3 is from Page8 (to Page9) ?

    opened by yannicklin 2
  • Test form filling

    Test form filling

    Tests for form filling where removed in b5631ecb7c212de9b8d5da032d16d81ed610949b. We should find a better way to test this. Also the test files need some cleanup/refactoring.

    enhancement 
    opened by mikehaertl 0
Releases(0.13.0)
Owner
Michael Härtl
Michael Härtl
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
Magento 2 Module for creating PDF's based on wkhtmltopdf

Magento 2 PDF generator Magento 2 module to ease the pdf generation using wkhtmltopdf features Installation composer require "staempfli/magento2-modul

Stämpfli AG 56 Jul 7, 2022
Official clone of PHP library to generate PDF documents and barcodes

TCPDF PHP PDF Library Please consider supporting this project by making a donation via PayPal category Library author Nicola Asuni [email protected] co

Tecnick.com LTD 3.6k Jan 6, 2023
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
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
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
Official clone of PHP library to generate PDF documents and barcodes

TCPDF PHP PDF Library Please consider supporting this project by making a donation via PayPal category Library author Nicola Asuni [email protected] co

Tecnick.com LTD 3.6k Dec 26, 2022
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
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
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
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
Laravel Snappy PDF

Snappy PDF/Image Wrapper for Laravel 5 and Lumen 5.1 This package is a ServiceProvider for Snappy: https://github.com/KnpLabs/snappy. Wkhtmltopdf Inst

Barry vd. Heuvel 2.3k Jan 2, 2023
Sign PDF files with valid x509 certificate

Sign PDF files with valid x509 certificate Require this package in your composer.json and update composer. This will download the package and the depe

Lucas Nepomuceno 175 Jan 2, 2023
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
Convert a pdf to an image

Convert a pdf to an image This package provides an easy to work with class to convert PDF's to images. Spatie is a webdesign agency in Antwerp, Belgiu

Spatie 1.1k Dec 29, 2022
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