gopdfrab 1.3.0: nothing lost quietly, smaller binaries
gopdfrab 1.3.0 is out. Conversion no longer drops content without saying so, and it no longer writes broken files that it reports as conformant. Binaries are smaller and conversion is faster. The browser validator already runs the new version.
Nothing lost quietly
PDF/A-1 does not allow embedded files, so convert removes them, along with annotations the standard forbids. It did that without telling you. They are now listed with the rest of the content a conversion could not keep.
Layers were worse. A PDF can hide some of its layers, such as a draft watermark or an alternative language. PDF/A-1 has no layers, and removing them made the hidden ones visible in the output. Hidden layers are now removed and reported, and the fidelity check compares against the page as you would actually see it.
Two bugs could produce a corrupt file that gopdfrab still called conformant. When several parts of a document shared one stream, or several fonts shared one embedded font file, a repair reached only one of them and left the others pointing at data that no longer matched. Every user of a shared stream or font file now gets the repair.
Fewer pages turned into pictures
Charts often wrap their labels in a transparency group even when nothing in it is transparent. Convert used to turn such a figure into a picture. It now removes the empty group and the figure stays text and lines.
When transparency really has to go, the flattened result looks closer to the original. Light fills no longer vanish or turn grey, and overlapping ones no longer wash out. Pages that do end up as pictures draw their fonts and colours correctly in more cases.
Smaller and faster
Every binary is about 1 MB smaller, 1.6 MB in WebAssembly, because the Arlington model behind the object-model checks now ships as 17.5 KB of embedded data. Conversion makes about a third fewer allocations and runs about 15% faster on files with many objects.
A program that only validates can import github.com/voidrab/gopdfrab/verify. It has the same API under the same names and leaves the converter out. The verify-only WebAssembly module is 6.2 MB against 15.1 MB for the full one, which is why this site can check a file before the converter has even downloaded.
One file in our test corpus made verify run out of memory. It repeated the same out-of-range number millions of times, and each one became its own issue. A problem repeated throughout a page is now reported once, with a count.
Upgrading
Existing Go code keeps compiling. Code that counts issues will see lower numbers, since repeats are now folded into one. The lookups CheckByClause and ChecksForClause are deprecated, because a clause number only means something within one PDF/A level. Use CheckByClauseIn and ChecksForClauseIn, which take the level. See profiles for the details. The full list of changes is in the changelog.