durcap2011 / engipdf
Web editor + pure PHP PDF generator from JSON templates
Requires
- php: ^8.2
- ext-gd: *
- ext-mbstring: *
- ext-zlib: *
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-09-15 07:29:57 UTC
README
Web editor + pure PHP PDF generator for templates.
Requirements
- PHP >= 8.2
- Extensions:
zlib,mbstring,gd
Installation
composer require durcap2011/engipdf
Usage
<?php require 'vendor/autoload.php'; use EngiPDF\Renderer\PdfRenderer; use EngiPDF\Template\TemplateLoader; $loader = new TemplateLoader(); $renderer = new PdfRenderer(); $template = $loader->loadFromFile('templates/fattura.json'); $data = [ 'fattura' => ['numero' => '2026/001'], 'cliente' => ['nome' => 'Mario Rossi'], ]; $pdf = $renderer->render($template, $data); file_put_contents('output.pdf', $pdf);
Structure
engipdf/
├── src/ # PHP engine (PDF generator)
│ ├── PdfWriter/ # Binary PDF writer
│ ├── Font/ # Type1 and TTF font handling
│ ├── Renderer/ # Template → PDF renderer
│ └── Template/ # Loader and placeholder resolver
├── editor/ # Vue 3 web editor (source)
│ └── dist/ # Static editor build
├── templates/ # Example JSON templates
├── examples/ # Usage examples
└── docs/ # Full documentation
Editor
The editor is a Vue 3 app that runs entirely in the browser. To start it locally:
cd editor
npm install
npm run dev
Opens at http://localhost:5173.
To generate a production build:
npm run build
Static files are generated in editor/dist/.
Open the HOST_SERVER/ROOT_DIR/vendor/durcap2011/engipdf/editor/dist/ path to open the editor. Modify the HOST_SERVER/ROOT_DIR/vendor/durcap2011/engipdf/editor/dist/index.html file by replacing lines 10 and 11, respectively, with:
<script type="module" crossorigin src="./assets/index-ChsEoyqH.js"></script> <link rel="stylesheet" crossorigin href="./assets/index-D9zxqf0v.css" />
Documentation
Components
28 components available in the editor: text, table, rectangle, line, list, image, QR code, barcode, citation, callout, code block, checklist, radio, ellipse, divider, stamp, watermark, signature, progress bar, chart, icon, group, container, page break, page number, date, data repeat, spacer.
Running Tests
composer install ./vendor/bin/phpunit
License
MIT — see LICENSE.