reinvanoyen/dry-pdfgen

There is no license information available for the latest version (1.0.0) of this package.

Generate PDFs using Dompdf

1.0.0 2019-11-26 14:08 UTC

This package is auto-updated.

Last update: 2024-10-27 02:14:54 UTC


README

Generate PDF-documents from HTML markup

dry-pdfgen uses Dompdf in the background. For more info on Dompdf check out their Github repository: https://github.com/dompdf/dompdf

Installation

composer require reinvanoyen/dry-pdfgen

Register the service provider

<?php

$app = new \Oak\Application();

$app->register([
    \Tnt\PdfGen\PdfGenServiceProvider::class,
]);

$app->bootstrap();

Basic usage

<?php

$pdfGenerator = $app->get(PdfGenerator::class);
$pdfGenerator->fromHtml('<strong>This is an example</strong>');

// Stream the pdf
$pdfGenerator->stream();
// or...
// ...use the pdf file contents
$contents = $pdfGenerator->output();