

The most mature and strict validator seems to be veraPDF, an open source tool that has been developed in cooperation with the Open Preservation Foundation and the PDF Association (the creators of the PDF/A standard). To verify that a PDF/A document is compliant, there are a couple of tools available, some commercial ones and some open source tools. The newest version is PDF/A-3 ( for more details, see Wikipedia).Īpparently the PDF/A-1b standard is a common requirement nowadays when generating PDF documents, so it was about time to extend Qt’s PDF engine to generate standard compliant documents and this is exactly what KDAB did during the last weeks :). The oldest and most restrictive version is PDF/A-1, with its sub-versions PDF/A-1b and PDF/A-1a.


There are various levels of conformance, which differ in the required PDF base version and the prohibited features. linking font files), through dynamic content (JavaScript, audio and video) up to the usage of proprietary compression algorithms or encryption. Those features range from dependencies on external resources (e.g. This standard defines which features are prohibited in a PDF document, since they would be ill-suited for long-term archiving. If you haven’t heard about it yet, PDF/A is an ISO-standard that describes a subset of PDF which should be used for archiving of digital documents. While the original version of Qt’s PDF engine just creates documents that conform to version 1.4, nowadays it is more and more important to conform to the PDF/A standard. The same applies to the graphics you create with the various QPainter::draw*() calls. Only QPainter::drawImage() and QPainter::drawPixmap() calls will store the passed images as bitmaps inside the PDF document, so you cannot scale them without aliasing artifacts. In more recent Qt versions you can also use the QPdfWriter class directly, to avoid the dependency on QPrinter. The text, that you draw with QPainter::drawText(), is stored as actual characters inside the PDF file, so it is searchable and scalable. Qt has supported the generation of PDF documents since Qt 4.1, by using a QPrinter object, setting its output format to QPrinter::PdfFormat and then using a QPainter to draw arbitrary text, graphics and images onto it. However, since the overall PDF standard is too complex, to guarantee that PDF documents can be rendered in their entirety in the future when using all features, this standard restricts the allowed features to a sensible minimum.
QT PDFWRITER EXAMPLE ARCHIVE
Nowadays, many official institutions have the requirement to archive their data digitally and PDF is a first class citizen for this purpose.

This is pretty annoying seeing as though I've already loaded some fonts and everything is working.As there were some complex issues around conformity in PDF document creation within Qt, KDAB let me spend some time digging into it so we could make sure that Qt’s PDF engine generates documents up to ISO-standard. My problem is that I still get the error printout saying "QFontDatabase: Cannot find font.". Now my PDF generation works and is able to use the font that is manually loaded. I went to the dejavu website and downloaded the available fonts and am now loading the fonts using: QFontDatabase::addApplicationFont("C:/Users/username/Downloads/dejavu-fonts-ttf-2.37/ttf/DejaVuSans.ttf") Deploy some (from for example) or switch to fontconfig. However when I pass the arguments -platform offscreen I then loose my fonts used by QPainter and get the following output: QFontDatabase: Cannot find font directory C:/Qt/5.9.2/msvc2013_64/lib/fonts. I learned that I had to use a QGuiApplication object instead and pass in the arguments -platform offscreen to fix the display problem. Originally I was using a QApplication object, but when run without a display I'd get the following output: QXcbConnection: Could not connect to display My problem is in getting the program to run without a display AND get QPainter to draw text. I've already developed the PDF writing part of my program and that all works great (I'm able to draw lines/text/images no problem). For the PDF writing I'm using the QPdfWriter class with a QPainter object. I'm writing a Qt program that is meant to run without a display and will generate PDF files.
