PDF/A-3 attachments
- Attaching a file through
Pdf.attachmentsnow lists its file specification in the document catalog's/AF(associated files) array, and deleting or replacing an attachment removes its entry. Together with the/AFRelationshippikepdf already writes, a file attached to a PDF/A-3 document now keeps it conformant. qpdf maintains only the/EmbeddedFilesname tree, so this was previously left to the user. {issue}463 - The PDF/A validator now approves embedded files in PDF/A-3b documents: the
/EmbeddedFilesname tree and the catalog's/AFarray are checked against clause 6.8 of ISO 19005-3 (MIME type,/Fand/UF,/AFRelationship, and that every embedded file is an associated file). Embedded files anywhere else, such as in file attachment annotations, are still reported as unsupported; they remain violations in PDF/A-1b and unsupported in PDF/A-2b. {func}pikepdf.pdfa.preparegives PDF/A-3 embedded files a missing MIME type (application/octet-stream) and/AFRelationship(/Unspecified), and lists unassociated ones in the catalog's/AFarray; new {class}pikepdf.pdfa.PrepareResultfields count these repairs. See {ref}pdfa-attachments.
PDF/A named destinations
- The PDF/A validator now checks named destinations, in the
/Destsname tree and in the catalog's/Destsdictionary, instead of reporting them as unsupported. Named destinations are common: pdfTeX (hyperref), Acrobat Distiller and JasperReports write them. It also checks named appearance streams (/Names /AP) as Form XObjects. /AlternatePresentationsis now reported as a violation of PDF/A-2 and PDF/A-3 (clause 6.10), and document-level JavaScript (/Names /JavaScript) as a violation of the rule forbidding JavaScript actions; both were reported as unsupported. {func}pikepdf.pdfa.prepareremoves them.- {func}
pikepdf.pdfa.preparegives the encoding of a non-symbolic TrueType font that has/Differencesbut no/BaseEncodingthe base encoding/WinAnsiEncoding, as PDF/A-2 and PDF/A-3 require, when no glyph the document draws would change. Older producers such as OpenPDF write such encodings. New {class}pikepdf.pdfa.PrepareResultfields report these repairs.
PDF/A developer extensions
- The PDF/A validator now checks the Adobe developer extensions dictionary
(
/Extensions << /ADBE ... >>) that Acrobat writes in the document catalog, instead of reporting every such file as unsupported. qpdf rewrites this entry to match the written version and extension level, and removes it for PDF/A-1, and the validator checks the entry as it will be written. Other developer extensions remain unsupported. - {func}
pikepdf.pdfa.resolve_save_kwargsaccepts an extension level inmin_versionorforce_versionfor PDF/A-2 and PDF/A-3, such as('1.7', 8).
Metadata
- New {meth}
pikepdf.models.PdfMetadata.copy_propertiescopies named XMP properties from other metadata with their whole value: every language of a language alternative, array order, structures and qualifiers, which assigning a value read from the source would lose. Properties are read from everyrdf:Descriptionwhatever itsrdf:about, and the structure of known properties is checked as for assignment. This is useful to restore metadata another tool dropped while rewriting a document.
PDF/A annotations
- {func}
pikepdf.pdfa.repair_annotation_flags, the step of {func}pikepdf.pdfa.preparethat removes hidden annotations and sets the Print flag on the rest, is now public, with its result {class}pikepdf.pdfa.AnnotationRepairResult. Running it before handing a file to another PDF/A converter such as Ghostscript keeps hyperlinks that producers wrote without the Print flag, which Ghostscript's PDF/A mode deletes.
Fixes
- The PDF/A validator reported the standard stream key
/DL(decoded length) as unsupported on content streams, images, metadata streams and output intent profiles, so a file whose producer writes it could not be converted. It is now accepted on every stream. - The PDF/A validator accepted glyph names in a non-symbolic TrueType font's
/Differencesonly from the Adobe Glyph List for New Fonts, so it rejected valid PDF/A-2 and PDF/A-3 files that used other names from the full Adobe Glyph List, such asafii10017for Cyrillic text. It now accepts every name in the full list, as ISO 19005 requires and veraPDF checks. Names outside the list, such asuni0410orA.sc, are still rejected. - A
Pdfopened or created withconversion_mode='explicit'returned plainintfor some numbers that qpdf writes itself, such as/Pages /Countafter adding or removing a page,/Rotateafter {meth}pikepdf.Page.rotate, or the/BBoxof {meth}pikepdf.Page.as_form_xobject. These values now follow the document's conversion mode like any other. - In explicit conversion mode,
IntegerandRealnow support the rest of the Python number protocol, with the same results as theintorDecimalthat implicit mode produces:round(),math.trunc(),math.floor(),math.ceil(),divmod(), and format specs such asf'{x:.2f}'.int()of aRealnow truncates, asint()of aDecimaldoes, instead of raisingTypeError; for exampleint(page.Rotate)now works on a/Rotate 90.0. - The type stubs for
Matrixnow accept apikepdf.Object, such as a/Matrixarray, and a list of objects, as the runtime always has.