PDF Generation

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

Almost every business backend ends up producing PDF files: invoices, statements, contracts, tickets and monthly reports. This section describes how a Java service does that, from the structure of a PDF file to programmatic layout with iText, template-driven reports with JasperReports, signing with PAdES, fillable forms and barcodes. Versions and dates are re-verified when each page is written and are stated as of the date checked.

Running scenario: Bookshelf Billing

Every page uses the same example, the back office of the Bookshelf store used by the Python sections. It is a Spring Boot 4 service on Java 21 that produces:

  • customer invoices with iText, each carrying a VeriFactu-style QR code and a PAdES signature;

  • a monthly sales report grouped by category, with charts and a crosstab, built with JasperReports from PostgreSQL;

  • an editable customer onboarding form (AcroForm) that is returned signed.

No page uses real certificates, keys, tax identifiers or customer data. Signing examples use a test certificate authority generated on the page, timestamps come from a public test time-stamping authority, and tax-authority examples target pre-production endpoints only.

flowchart LR D["Data: PostgreSQL, REST, files"] --> I["iText: invoices, forms"] D --> J["JasperReports: sales report"] I --> Q["Barcodes and QR codes"] Q --> S["PAdES signature"] J --> S S --> O["Object storage and delivery"] I --> A["PDF/A and PDF/UA conformance"] J --> A

Reading paths

  • Report designer. Start with the template-report approach and the JasperReports pages, then the reports-from-data material and the conformance pages.

  • Backend developer. Start with the introduction, the PDF file structure and the Spring Boot setup, then iText layout, forms and barcodes.

  • Signing and compliance. Start with the standards and conformance pages, then PAdES signatures, timestamps and long-term validation, and the regulated QR codes for invoices.

Pages

Foundations

iText

JasperReports

Digital signatures

Forms and barcodes

Beyond

Existing pages this section builds on

Bibliography

The pages of this section are written against the official documentation listed here and verified on 2026-10-09 against the versions stated on each page: iText 9.8.0, pdfHTML 6.3.4, JasperReports 7.0.8, Apache PDFBox 3.0.8, EU DSS 6.5, ZXing 3.5.4 and Bouncy Castle 1.86.

Books

Three books were consulted for the concepts they cover and the order in which they present them. They are cited and linked to their official pages. No text, code listing, figure or dataset from them is reproduced, and they were not used as the source of any code example. All three predate the versions above, and the pages say in prose where a book is outdated and show the current approach (the findings are collected in What’s Changed and Migration).

  • Bruno Lowagie, iText in Action: Creating and Manipulating PDF, first edition, Manning, 2006 (print 2007), ISBN 978-1-932394-79-5. Targets iText 1.4 and the com.lowagie packages, on JDK 1.4 and PDF 1.6. Publisher page. A second edition exists (Manning, 2010, for iText 5), publisher page; it was not consulted.

  • Teodor Danciu and Lucian Chirita, The Definitive Guide to JasperReports, Apress, 2007, ISBN 978-1-59059-927-3 (eBook 978-1-4302-0521-0). Targets JasperReports 1.3.x and iText 1.x. Publisher page at Springer (Apress is a Springer imprint).

  • Teodor Danciu, The JasperReports Ultimate Guide, version 1.0, self-published, 2002, no ISBN. Targets JasperReports 0.4 and 0.5 and the dori.jasper packages. The guide has no publisher page. The project’s official site, JasperReports library documentation, is its editorial home, and lists a later edition as JasperReports Ultimate Guide 3.

Signatures, PDF libraries and validation

References

The official documentation behind the overview on this page; each page of the section lists its own references.