Skip to content

Releases: famoser/pdf-generator

Meta and Text Alignment

02 Jan 13:52
Compare
Choose a tag to compare

This release adds machine-readable meta data to the PDF in the form of dublincore elements.

$meta = Meta::basic('en', 'My little PDF', ['Me', 'Myself', '& I']);
$document = new Document(meta: $meta);

Further, the text rendering has been improved, and now notably supports alignment:

$text = new Text(alignment: Text\Alignment::ALIGNMENT_JUSTIFIED);
$text->addSpan('This text is broken automatically into several lines, and then justified to avoid whitespace at the column boundary.', $textStyle);
$document->add($text);

As part of this release, the Printer and Document APIs have been clarified: The first is to print content (rectangles, images) at a predetermined position, while the second measures and allocates more complex layout elements (tables, grids, text) automatically.

v0.6.1

17 Nov 10:24
Compare
Choose a tag to compare

Release of v0.6.1

Tables & Grids

03 Jan 21:53
Compare
Choose a tag to compare

This adds support for grids and tables to the LayoutEngine.

The grid and the table support columns sized relative to the content. While the grid provides gaps (both horizontal as well as vertical), the table provides head and body (with the head printed on every page the table spans over).

$row = new Row();
foreach (['1', 'Second column text'] as $index => $text) {
    $paragraph = new Paragraph();
    $paragraph->add($textStyle, $text);

    $row->setContent($index, $paragraph);
}

$table = new Table([ColumnSize::MINIMAL, ColumnSize::AUTO]);
$table->addBody($row);

$document->add($table);

As part of this release, text copied out of the PDF now works in all readers (not only those which employ OCR). Further, allocation is now guaranteed to always produce a result, which ensures too-big-content also lands on the PDF.

LayoutEngine

08 Jul 09:51
7d264ca
Compare
Choose a tag to compare

This adds support for a layout engine.

Place content as part of a layout (recursively!), and let the pdf-generator decide where to place it. This is useful for content of unknown size; e.g. a large text which spans over multiple pages:

$paragraph = new Paragraph();
$paragraph->add($normalText, "Long text");

$flow = new Flow();
$flow->addContent($paragraph);

$document->add($flow);

Supported in this release are flows (place content horizontally or vertically one-after-the-other) and simple blocks (add padding, margin etc to the inner block/content).

As part of this release, the direct printing API has been reworked, too. This remains useful for content where you know the placement (e.g. the address of an invoice).

FlowPrinter

07 Jul 12:20
82e4cf7
Compare
Choose a tag to compare
FlowPrinter Pre-release
Pre-release

Adds a printer which supports an automatically moving cursor.

This allows to print images and rectangles, with the cursor ending up at the bottom right. Further, paragraphs with automatic line-breaking can be printed, with the cursor ending up at the last line after the last character. All fonts (both embedded as well as default) are supported.

PDFs with embedded fonts

02 Jul 06:12
Compare
Choose a tag to compare
Pre-release

Adds support for embedded fonts and full UTF-8 range.

This release adds a TTF reader and writer. It automatically creates subsets of the embedded fonts, so only the characters are included in the PDF that are actually used. Composite glyphs are supported (like Ä; an A and two dots), ligatures (characters joined together; like ff) and multi-byte (for example emojis) are not.

Render basic PDFs

23 Jun 08:39
08a9c7a
Compare
Choose a tag to compare
Render basic PDFs Pre-release
Pre-release

Allows to print text, images and rectangles on a pdf document.

There is no frontend yet with an easy to use public API. You can however work with the Printer from the IR.
The printer has some limitations; specifically:

  • The coordinates of the printed elements are in the bottom-left corner
  • Not the full UTF-8 range of characters can be printed; if you character is out of the latin1 range you are out of luck currently
  • Embedded fonts have not been fully implemented yet

Layout specification

28 Jan 20:57
Compare
Choose a tag to compare
Layout specification Pre-release
Pre-release

Adds the public API for the generator.

Pdf generation is not yet implemented.