Andrei Augustin 3904188903
Initial support for PDF/A-1a/b (#1395)
* pdf/a1b support initial commit

Added mixin for support pdf/a1b and a few of the things it requires (xmp metadata, colour profile). Currently, the CIDSet stream is the only error it comes back with the test case I'm using, will try sorting it out next.

* Adding CIDSet when generating PDF/A

PDF/A1 b/a requires a CIDSet. This is not checked by a validator and other converters seem to add a CIDSet with a value of FF FF FF FF 0C, so this commit does the same. When extending support for PDF/A 2/3/4, we may not add a CIDSet (I think for PDF/A3 it's not required?) or we will look for a proper way to generate the CIDSet.

At this point, PDFKit should be able to generate PDF/A1b which can pass veraPDF validation and PDF/A1a if tagged is enabled.

All you have to do is set pdfa: '1a' or pdfa: '1b' in the options passed to new PDFDocument.

* pdf/a intro docs

* generalising subsets, reimplementing pdfa1 and added control over metadata

added a generalised subsets mixin which can pull in a subset at runtime.
reimplemented pdfa1 mixin as some features should be standardised across all subsets, such as storing /Info as xmp metadata for pdf >1.3
added a metadata class and mixing to control and write the metadata to a pdf

* added tests for pdfa1 and metadata and moved joinTokens in helpers

Addeds tests for pdfa1 subset and metadata.
Moved joinTokens into helpers.js as it's now used in at least two places.
Added tests for document to when metadata should be added (pdf version 1.4 or newer) and when it shouldn't (pdf version 1.3)

* updated pdf/a docs to reflect latest changes

* store color profile as icc file

* Updated changelog to include PDF/A support in Unreleased section
2023-01-06 19:25:11 -03:00
..
2014-02-17 23:43:22 -08:00
2014-02-22 23:33:36 -08:00
2019-03-25 10:16:32 +01:00
2021-03-28 10:14:05 -03:00
2021-04-03 21:06:31 -03:00
2019-03-24 13:37:26 +01:00
2021-07-10 23:20:27 -03:00
2019-04-30 15:44:49 +02:00

PDFKit Guide

The PDFKit guide can be read a number of ways. The first is online at pdfkit.org. You can also read the guide in PDF form, in this directory or online.

Both the website and the PDF guide are generated from the Markdown files in this directory. Just run npm run docs to generate them. You will need to have ImageMagick 7 installed so the magick command is on your $PATH.

The examples are actually run when generating the PDF in order to show the results inline. The generate.js file in this directory is actually quite short. It parses the markdown files into a tree structure using markdown-js, syntax highlights the code examples using codemirror, compiles and runs the code examples and puts the results inline, and generates the PDF using PDFKit. You can read the generator script source code to get a feeling for how you might do something slightly more complex than the guide itself shows.

The markdown syntax used is pretty much standard, with a couple tweaks.

  1. Code example output is references using the image notation, using the alt text as the example number starting from zero in the current file, and the title as the example output height. E.g. ![x](name "height").

  2. Page breaks are added before h1 and h2s, unless there are two in a row. h3 is treated the same as h2 but can be used to avoid this in the case you need multiple h2s on the same page.

  3. The horizontal rule syntax (* * *) denotes an explicit page break