3

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...

James Wierzba
  • 16,176
  • 14
  • 79
  • 120
  • See this http://stackoverflow.com/a/15412879/231316 – Chris Haas Aug 21 '13 at 18:31
  • possible duplicate of [How create PDF/A file from HTML using iTextSharp](http://stackoverflow.com/questions/15409617/how-create-pdf-a-file-from-html-using-itextsharp) – Martin Schröder Aug 21 '13 at 21:27
  • Use XSL FO and an engine which supports PDF/A (many of them do) – Kevin Brown Aug 22 '13 at 01:18
  • You might want to read [PDF/A-3 with iText](http://itextsupport.com/download/pdfa3.html). You can either try to transform the samples from Java to C# yourself or wait as the document says *PDF/A-3 with iTextSharp (C#, coming soon)*. – mkl Aug 22 '13 at 10:16
  • Using Ghostscript.Net and http://stackoverflow.com/questions/1659147/how-to-use-ghostscript-to-convert-pdf-to-pdf-a-or-pdf-x – mcandal Jul 16 '15 at 10:18

2 Answers2

4

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).

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
1

We decided to go with the official Adobe PDF Library because my company is hesitant to using any free / open source software.

The library has a simple function that converts PDF to PDFA. I have confirmed the output PDF is in PDFA using the preflight tool in Adobe Acrobat Pro, thanks Bruno Lowagie for that information.

James Wierzba
  • 16,176
  • 14
  • 79
  • 120