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.5k stars 581 forks source link

PDF/A PDF/UA Support #493

Open pipebaum opened 3 years ago

pipebaum commented 3 years ago

Trying to figure out if either PDF/A or PDF/UA are supported. If so what versions and is there any documentation?

asturio commented 3 years ago

Yes, PDF/A is supported. Take a look in the Class PdfWriter. You can use the method setPDFXConformance() and some of the Constants there, like PDFA1A or PDFA1B. There is no example for that, but you can create one in pdf-toolbox if you want. Pull requests are welcome.

andreasrosdal commented 2 years ago

What is needed to support PDF/UA? https://en.m.wikipedia.org/wiki/PDF/UA

arnthom commented 1 month ago

In Germany the "Barrierefreiheitsstärkungsgesetz" (accessibility strenghtening act) comes into force in June 2025. All companies (like insurance etc) have to ensure, that their pdf documents are compatible and accessible i.e. for blind people. Therefore I look for the parameters to set to ensure pdf/a compatibility. There is a check tool available at https://pdfua.foundation/de/

When doing a short check for my pdf created with OpenPdf 2.0.2 i see

More Information available at

Any news on pdf/ua?

mkl-public commented 1 month ago

Most of the items you list are things you can already do easily with OpenPdf, you merely are not forced to do them by the software, you have to remember doing them yourself.

arnthom commented 1 month ago

I use openpdf as a library creating the pdf documentation for my software product. I cannot patch every pdf that is created, i have to do it with the openpdf software. So there should be a way to define the xmp meta data or the document's language with methods of pdfwriter or pdfdocument.

But maybe ou can tell me how to do it "easily with OpenPdf", perhaps I'll find a wworkaround.

mkl-public commented 1 month ago

So there should be a way to define the xmp meta data or the document's language with methods of pdfwriter or pdfdocument.

You might want to look at PdfWriter.createXmpMetadata that creates metadata from existing info data (or PdfWriter.setXmpMetadata if you want to create the metadata yourself, e.g. with Adobe's XMP Toolkit for Java).

The document language is but an entry in the PDF catalog dictionary.

I would assume, though, that creating PDF/UA conform tagging will be the largest challenge.

arnthom commented 1 week ago

Neither of the document.add-methods for Subject, Keywords, Author and Creator nor document,setDocumentLanguage() make their way to the Pdf catalog dictionary. writer.createXmpMetadata() does not seem to make a difference, although the methods mentioned above have been called.

Would it be possible as a first step to write this catalog dictionary into the pdf file?