ICC color profiles for used color spaces must be embeddedĮmbedding this information into the PDF document makes it slightly larger than its PDF-1.4 equivalent, which is why QPrinter and QPdfWriter do not use the PDF/A-1b format as default.įrom Qt 5.10 on, you can enable PDF/A-1b support in QPrinter/ QPdfWriter by setting their pdfVersion property to PdfVersion_A1b as default instead of PdfVersion_1_4.meta data must be embedded in the Extensible Metadata Platform format (XMP).There are also some requirements in PDF/A-1b, which have not been supported yet, namely: So if you configure QPainter‘s pen or brush with a color or gradient that contains an alpha channel, the channel is removed. Semi-transparent colors are also not allowed for drawing. This means, if you call QPainter::drawImage/Pixmap() with an image that contains an alpha channel, the Qt PDF engine will replace the transparent pixels with white ones and store the result inside the PDF. Since PDF/A-1b is based on PDF-1.4, we didn’t have to change much of the basic generation code in Qt’s PDF engine, just some smaller syntax fixes were needed to make the validator happy.Īdditionally, transparency in embedded images is not allowed. 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. Nowadays, many official institutions have the requirement to archive their data digitally and PDF is a first class citizen for this purpose. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |