2017 © Pedro Peláez
 

library pdf-lib

Library for loading or creating a PDF

image

10usb/pdf-lib

Library for loading or creating a PDF

  • Wednesday, August 23, 2017
  • by 10usb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

pdf-lib

A PHP PDF library that is not created to easily add rich content (HTML etc) to a PDF file. But rather allowing any valid PDF content to be added to the file without the excess of functionality that "tries" to emulate HTML like behavior and limit/complicate simple tasks. This library takes the concept that every page is no more then just a canvas area that can takes 2D graphics rendering commands. Any other functionality there might be is considers meta data., (*1)

Example

$file = new File('test.pdf');
$file->getInformation()
    ->setTitle('My PDF Library')
    ->setSubject('How to create a pdf library')
    ->setAuthor('10usb');

$catalog = $file->getCatalog()->setSize(595.276, 841.890);


$page = $catalog->addPage();

$canvas = $page->getCanvas();

$canvas->setStrokeColor(255, 0, 255);
$canvas->setLineWidth(5);
$canvas->line(30, 30, 50, 100);


$canvas->setFillColor(50, 50, 50);
$canvas->setFont($page->getFont('Helvetica', 11));
$canvas->text(50, 50, "PDF Library");
$canvas->text(50, 70, "You start with...");

$file->flush();

Nice to have

While a lot can be done, more can be done. - Ability to set the compression/filter methods to use (or none) - Append the contents of one file to then end of an other (or even better insert between) - Clean-up an incremental updated pdf file - Add optimization of render insttructions - Add optimization by shared resource dictionary between pages, (*2)

The Versions

23/08 2017

dev-master

9999999-dev

Library for loading or creating a PDF

  Sources   Download

The Requires

  • php >=7.0

 

13/08 2017

1.0.0

1.0.0.0

Library for loading or creating a PDF

  Sources   Download

The Requires

  • php >=7.0