Search code examples
c#pdfwkhtmltopdfpdfa

Create PDF/A with WKHTMLTOPDF w/o using Ghostscript?


We use WKHTMLTOPDF to create PDF documents out of HTML in our C# Project. But we have to be PDF/A compliant with our PDF-Files. At the moment we use another external component to convert from PDF to PDF/A

Is there no direct way to generate PDF/A compliant documents with WKHTMLTOPDF?

Maybe a WKHTMLTOPDF "Fork" or something?


Solution

  • Not currently (has been an open issue since 2014)

    PDF/* are SUPERsets (designed by committee) of good old functional PDF 1.0 ideals.

    That is certain things MUST and must NOT be included.

    WKHTMLTOPDF is built on QT WEBKIT viewer where those requirements are not needed in order to display PDF i.e. it can display some but not all conforming and non conforming PDFs, its a PDF viewer not creator.

    You can as you know use GS to adjust and create the parts needed for some PDF conformances

    Your best viable alternative is to use open source iText 7 specifically:-

    https://github.com/itext/i7n-pdfhtml

    an iText 7 add-on for C# (.NET) that allows you to easily convert HTML and CSS into standards compliant PDFs