LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.64k stars 599 forks source link

What PDF and PDF/A versions are supported? #559

Open katjas opened 3 years ago

katjas commented 3 years ago

Hi there

we are evaluating which PDF creating library we want to use in our company (we are currently using an iText 2.1.7 and would like to replace it). The main criteria are to be able to produce PDFs in version 1.7 respectively PDF/A-2 at least. I the OpenPDF library able to produce such files? I have not found this information in the available documentation unfortunately.

Thanks in advance and kind regards Katja Sondermann

asturio commented 3 years ago

As from the source code, there seems to be support for PDF 1.7, and PDF/A1A and PDF/A1B https://github.com/LibrePDF/OpenPDF/blob/12ecb0f21b3766f19f46a5ff902e0008b1b883dd/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java#L1346 https://github.com/LibrePDF/OpenPDF/blob/12ecb0f21b3766f19f46a5ff902e0008b1b883dd/openpdf/src/main/java/com/lowagie/text/pdf/PdfWriter.java#L1737

Please be aware that OpenPDF is a maintained fork of iText 2.1.7, with some Java and dependencies updates, but there is no relation to itextpdf.com.

andreasrosdal commented 2 years ago

I recommend that you update from iText to OpenPDF.

What is needed for OpenPDF to support PDF/A-2?

https://www.loc.gov/preservation/digital/formats/fdd/fdd000319.shtml

hvbtup commented 1 year ago

I'm not really an expert, but AFAIK in order to create a document that claims to be PDF/A, basically the following steps are necessary:

Then one can use a PDF/A validator tool and (as long as the PDF doesn't contain more exotic features) the validator should accept the PDF.

In one of our commercial products, we are generating PDFs with BIRT, which used iText 2.1.7 internally in older releases and now uses OpenPDF and we post-process these PDFs later as I described above to make them PDF/A-3 compliant (with conformance level B). For this conversion, we are using a little custom code and Apache PDFBox, but of course it would be nice if OpenPDF supported this. This would allow Eclipse BIRT to generate PDF/A directly.

Based on this, one can also create ZUGFeRD aka Factur-X invoices. This is a standard based on PDF/A, where a single PDF file contains a human-readable, printable invoice and a machine-readable XML representation of the invoice. Basically, one needs a PDF file and the corresponding XML file and combines this to one ZUGFeRD file (which is PDF/A-3 compliant). However, the XML has to be created in addition to the PDF - it cannot be derived from PDF automatically, so this cannoit not be done with OpenPDF alone.

luzhanov commented 1 year ago

@hvbtup may I ask you for some hints about PDF post-processing you've used? How it can be implemented?

hvbtup commented 1 year ago

Sorry, I can't give you more hints than the pointers I already gave, because that code itself is not open source. But if you have more specific questions, please feel free to ask.

Unfortunately I will not be able to answer any questions before mid June.