mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-26 11:09:23 -06:00
engine::pdf writes print-ready documents: pages of any size in points with raster images placed on them, each image tagged with its ICC profile as an ICCBased colour space (RGB, CMYK or grey), stored losslessly with Flate at 8 or 16 bits per component (16-bit samples big-endian), or copied as a JPEG stream where file size matters more. A profile shared by several images is written once. An optional output intent names the printer / paper profile the file was made for (PDF/X-style /OutputIntents in the catalog); the Info dictionary carries the title, as UTF-16 when it isn't plain ASCII. PDF 1.6 (16-bit images need 1.5), classic cross-reference table, deterministic bytes. Pages, images per page, page and image sizes are capped; bad sizes, placements, sample counts and component counts are errors, never panics. Tests read the files back through the xref table: image samples and profiles inflate to what went in, placements reach the content streams, one profile object is shared. Not wired to the print job yet.