I need to write a NET application that will take various data from databases and construct a PDF which must be in PDF/A format because of the companies standards.
So far I have looked at PDFSharp and iTextSharp
I see a topic in PDFSharp forums http://forum.pdfsharp.net/viewtopic.php?p=1293#p1293 dicussing this very topic and they have said years ago that PDF/A support is in their todo list, but nothing came of it.
I cannot find any information about PDF/A format using these libraries. Do I need to build the PDFs while meeting PDF/A restrictions? I do not know how to verify a file is in PDF/A format...
See the release notes and changelog of iText 5.3.4.
You can create PDF/A-1 (level A / level B), PDF/A-2 and PDF/A-3 files using iTextSharp. However, we only check conformance during the creation process for PDF/A-1. If you create PDF/A-2 and PDF/A-3 files, it's your responsibility as a developer not to introduce something that breaks PDF/A conformance. In future versions, iText will check that for you.
PDF/A-3 with iText gives you an idea of what is needed (the examples are in Java, but it shouldn't be a problem to port them to C#). Make sure you use the PdfAWriter
class instead of PdfWriter
, and make sure you have the latest version.
Note that creating PDF/A Level A is a challenge. You have to set the role of every element (Paragraph
, Anchor
,...) in your code. Often it's much easier to use an XFA template, fill it with XFA data, and then have iText's XFA Worker flatten it.
iText doesn't do verification of existing PDF/A files. It's important to know that the 'blue bar' shown on top of the document, saying that the document is PDF/A, isn't sufficient. You need to verify the document, for instance using Adobe Acrobat (Preflight functionality).