Download the PHP package peptolab/php2pdf without Composer

On this page you can find all versions of the php package peptolab/php2pdf. 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 php2pdf

Php2Pdf

A pure-PHP library for precision PDF layout: embedded fonts, PDF/AI/SVG templates, images, and text that flows through chained boxes across pages. It keeps the parts of PDFlib that matter for design-led documents and leaves out the rest.

Requires PHP 8.3+ with ext-zlib and ext-mbstring. No other runtime dependencies.

Status

This is an early release (0.1): the features listed in the changelog work and are tested, but the API is not settled. Until 1.0, a minor version may change it.

The library is plain PHP, with no extensions beyond zlib and mbstring, so text takes longer than in a C library. On a 2017 desktop (Core i7-7700K), flowing two columns of text takes about 2.5 ms a page; justified text, set by the whole-paragraph composer, about 5 ms. A 2,000-row table takes 1 s. That is 1.7 to 2.2 times PDFlib's time for text, and with opcache and its JIT enabled (opcache.jit_buffer_size) long documents take about a third less, 1.2 to 1.4 times PDFlib's. Tables and images are faster than in PDFlib: the 2,000-row table takes a quarter of its time and a third of its memory. Files are smaller than PDFlib's: 500 pages of text come to 570 KiB against its 609 KiB. tools/bench runs the scenarios these numbers come from.

Known gaps are listed in Limitations.

Documentation

The guides in docs/ cover installation, documents and pages, the canvas, fonts and text, images, the fit engine, templates and PDF import, SVG, Textflow, tables, links and PDF/X-4, a cookbook, limitations and development. Moving from PDFlib? See Coming from PDFlib.

Quick look

Units are points (1/72 in). Unit::mm(), Unit::in() and Box::fromMm() convert at the API boundary. The origin is bottom-left as in PDF; pass topDown: true to addPage() (or set it in DocumentOptions) for a top-left origin with y growing downwards, as in design tools.

SVG

$doc->svg('logo.svg') converts an SVG to reusable artwork in pure PHP: paths and shapes, transforms, viewBox and nested viewports, fills and strokes with opacity, linear and radial gradients, patterns, clip paths, masks, group opacity, style sheets with simple selectors, <use>/<symbol>, markers, embedded PNG/JPEG images, and text set through the font engine so it stays searchable. Filters are skipped and reported by NativeConverter::warnings(). When full fidelity matters and rsvg-convert is installed, pass new RsvgConverter() instead: the SVG is converted by librsvg and imported through the PDF importer.

Tables

Tables flow through boxes like Textflows: columns are fixed, percentages or sized from their content; cells hold text, markup, Textflows or anything placeable, with column and row spans, padding, borders and backgrounds; header rows repeat in every box; grouped rows stay together; and a row too tall for the space left continues its text in the next box. Document::flow() drains any flowable across pages, making each page through a closure.

Links, bookmarks, PDF/X-4 and PDF/A

$page->addLink($box, 'https://…') or ->addLink($box, Destination::page(3)) makes an area a link; $doc->addDestination('chapter-2', Destination::top(5, 700)) names a place; and $doc->outline()->add('Chapter 2', 5)->add('Section', Destination::at(5, 0, 400)) builds the bookmarks panel.

new DocumentOptions(pdfx: PdfX::X4, rgbProfile: $srgb) writes PDF/X-4: PDF 1.6, trim boxes on every page, a DefaultRGB profile so RGB colours and images are device-independent, output intent and conformance declarations in the Info dictionary and XMP, and transparency groups in the output intent's colour space. The document refuses device colours the output intent cannot reproduce, imported pages that draw in them, links inside the printed area, badly nested page boxes, and closing without setOutputIntent() or a title. The structure follows ISO 15930-7; check the output with Acrobat Preflight or callas pdfToolbox for a formal check.

new DocumentOptions(pdfa: PdfA::A2b) writes PDF/A-2b, and PdfA::A3b PDF/A-3b, alone or with PDF/X-4; the output passes veraPDF. PDF/A-3 documents take attachments, and attachFacturX() makes a Factur-X (ZUGFeRD 2) e-invoice of one.

Design notes

Development

Install Mago once per machine, then:

QA configuration follows peptolab/peptolab-qa-tools; see Development.

Licence

MIT.


All versions of php2pdf with dependencies

PHP Build Version
Package Version
Requires php Version ~8.3.0 || ~8.4.0 || ~8.5.0
ext-zlib Version *
ext-mbstring Version *
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 peptolab/php2pdf contains the following files

Loading the files please wait ...