Download the PHP package vianetz/pdf-generator without Composer

On this page you can find all versions of the php package vianetz/pdf-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pdf-generator

vianetz Pdf Library

Generate PDF documents from HTML and merge them into one file - in pure PHP, without a headless browser or any other system binary, so it runs wherever your application runs.

Internally it uses the DomPDF library for PDF generation and FPDI for merging.

More information about this PDF API can also be found on my website.

Installation

Requires PHP 7.4 or later. Optionally install horstoeko/zugferd for attachments (ZUGFeRD / Factur-X) or tecnickcom/tcpdf for the TCPDF based merger.

Usage

Create PDF document from HTML

Use $pdf->toPdf() to get the raw contents instead. Besides HtmlDocument you may also add existing PDF files via $pdf->add(new \Vianetz\Pdf\Model\PdfDocument('terms.pdf')).

Each document is rendered on its own and the results are merged, so every document keeps its own header and footer data.

Configuration

Supported paper sizes are a3, a4, a5, letter and legal - any other size throws an UnsupportedPaperSizeException. See Config for further settings (temp dir, chroot dir).

Background templates

Each page can be stamped onto a template PDF, e.g. your letterhead:

Merge two PDF files into one PDF

PdfMerge::create() optionally takes the merger to use - Merger\Fpdf (default) or Merger\Fpdi (TCPDF). Pages are placed on the configured paper size, so a larger source gets cropped.

Attachments (ZUGFeRD / Factur-X)

ZugferdFpdf is the only merger supporting attachments, all others throw a \LogicException. As the factory always wires up the default merger you need to compose the pdf yourself:

Events

Pass an EventManagerInterface implementation as second argument to create() to hook into the pipeline - the default NoneEventManager does nothing.

Event Dispatched Data
vianetz_pdf_document_render_before before each document is rendered document, merger
vianetz_pdf_document_render_after after each document has been merged document, merger
vianetz_pdf_get_contents every time toPdf() returns contents

The merger belongs to the render in progress and must not be kept beyond it.

Error handling

A missing background template, an unreadable PDF file or an empty document throws rather than producing a partial PDF. All exceptions implement \Vianetz\Pdf\Exception, so one catch block covers them all:

Tips & Tricks

Frequently Asked Questions

Please find the Frequently Asked Questions on my website.

Support

If you have any issues or suggestions with this extension, please do not hesitate to contact me.

License

GNU General Public License v3.0
See also LICENSE file.

This extension uses the DomPDF library. For license information please visit the DomPdf repository.
This extension uses the FPDI library. For license information please visit the FPDI repository.

This library uses Semantic Versioning - please find more information at semver.org.


All versions of pdf-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8
dompdf/dompdf Version ^3.0
setasign/fpdi Version ^2.6
setasign/fpdf Version ^1.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vianetz/pdf-generator contains the following files

Loading the files please wait ...