Skip to content

Kommune3/PDFTemplate

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

PDFTemplate

PDFTemplate - Create PDF's from ODT Files and replace placeholders/variables

This modules offers an easy way to create PDFs from OpenDocument (.odt) templates. The magic: Each template can hold a variety of placeholders/variables that can easy be replaced.

This module integrates the free www.pdftemplate.eu service. No registration required!

Install via composer

composer require kommune3/pdftemplate

A simple example

<?php
use PDFTemplate\PDFTemplate;

$pdf = new PDFTemplate();

// Basic settings
$pdf->setFilename('example.pdf');
$pdf->setTemplate('odt/example.odt'); // Path to your local Open Document Template
$pdf->setDestination('local/folder'); // Set the destination where the generated PDF should be stored

// Set some vars
$pdf->addVar('first_name', 'John');
$pdf->addVar('last_name', 'Doe');

// Add a row
$row = new PDFTemplateRow('demoitems');
$row->addVar('position', '1');
$row->addVar('title', 'This is a title');
$row->addVar('quantity', '5');
$row->addVar('price', '15.99');

$pdf->addRow($row);

// Finally create the PDF
$pdf->createPDF();

About

Convert open office documents with variables into PDF files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages