Release

gopdfrab 1.2.0: fewer rasterized pages, clearer reports

Fewer pages turned into pictures during conversion, a CLI that says when it happens, and fewer false reports of missing characters.

gopdfrab 1.2.0 is out. Conversion turns fewer pages into pictures, and when it has to, the CLI now tells you which pages and what was lost. The browser validator already runs the new version.

A CLI report you can read

A problem that appears on many pages used to print one line per occurrence. It now prints once, with how often it occurs and on which pages, for example pages 3–7 instead of five separate lines. The layout of the text output is now fixed and documented, so scripts can rely on it. --detail brings back the full list.

convert now also lists the pages it turned into pictures, and anything it could not draw on them. Before, a conversion that replaced an image with a gray box printed only result: conformant, with no hint that anything was lost. See gopdfrab convert for the new lines.

More repaired in place

When convert cannot fix a page, it falls back to replacing the page with a picture of itself. The result conforms, but its text can no longer be selected or searched. 1.2.0 fixes these problems in place instead, so the page keeps its text:

  • Pages that nest their drawing settings deeper than PDF/A-1 allows. Each "save the current colours and position" has to be matched by a "restore", and PDF/A-1 caps how many can be open at once. Some PDF generators go past it.
  • Repeating background patterns whose colours have no colour profile to say how they should look in print.
  • Small images stored directly in the page using LZW compression, which PDF/A-1 does not allow.
  • Text that asks a font for a character the font does not contain.

Fewer false reports

PDF/A requires every character on a page to have a matching shape in the embedded font. gopdfrab sometimes checked a character against the wrong font, for example in content that borrows its font from the surrounding page, and looked up characters in TrueType fonts the wrong way. As a result, it reported characters as missing when they were not, missed some that really were, and converted some pages to pictures for no reason.

Files converted by gopdfrab that veraPDF rejected now pass it too. Most of the fixes are in how embedded fonts are written.

Upgrading

One change can affect existing Go code. A profile that does not name a supported PDF/A level, such as an empty Profile{} or NewProfile("A-2b"), used to run no checks at all and report every file as valid. Verify and Convert now return an error instead. Use gopdfrab.PDFA1B or another built-in profile. The full list of changes is in the changelog.