A PDF Publication can be done in several ways:
Option 1 : Making a HTML publication (with a standard Simplicité Publication Template or a Mustache Custom Template). It will open a new tab the user can then “print as” pdf from its own brower. This is the cheapest option.
- Upsides : beautiful, easy-to-develop, easy-to-maintain publications
- Downsides : impossibility to generate the PDF on the server (to send by email, or save on the object for example)
Option 2 : using a HTML publication + a third-party service to turn the generated HTML/CSS/JS into a PDF document.
- option A: rolling an on premise service with tools like https://wkhtmltopdf.org/ [free] or https://jsreport.net
- option B: using an online service (there are plenty) (generally not free)
- Upsides: same as option 1 + reliability & server-side rendering
- Downsides: external service, either not free or with maintenance
Option 3 : using a HTML publication & buy and add the iText library to your project to turn the generated HTML/CSS/JS into a PDF document. (we have not tested this option)
- Upsides: same as option 1 + reliability & server-side rendering + full Java (no external process to install)
- Downsides: library price + install complexity to add lib
Option 4 : use a PDF publication using open source Apache PDFBox
- Upsides: reliability & server-side rendering + full Java (no external process to install)
- Downsides: dev complexity (PDFs are hard to generate this way)
|HTML Publication (1)||HTML Pub + HTML to PDF service (2A)||JSON to PDF service (2B)||Java iText HTML to PDF (3)||Java Apache PDFBox (4)|
|Code complexity / Maintainability||easy||easy||none||easy||hard|
|Install / Operations complexity||none||easy (service) / medium (docker) / hard (non docker)||easy (cloud) / hard (on premise)||medium (include external lib)||none (lib included)|
|PDF rendering (server=> consistent+PDF savable and sendable by mail)||client side (HTML page > save as > PDF)||server (Simplicité calls webservice)||server (Simplicité calls webservice)||server||server|
|Template editable by client||Edit HTML in Simplicité||Edit HTML in Simplicité||Editable & user-friendly||No||No|
|Open Source / Free||yes||yes||no||no||yes|
Disclaimer: Simplicité contains an old iText “open source” 2.1.7 version, which is currently used by Simplicité’s PDFTool. We are planning to move away from iText 2.1.7 for licensing matters, so even though it is shiped with Simplicité we do NOT encourage you to use it in your custom code.
Options 2A and 4 are documented below.