mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-09 12:32:52 +00:00
Delete Image takes only the Do out of the page, and Replace Image adds a new name and leaves the old image listed. Remove Hidden Information only pruned the names its own content pass replaced, so a deleted image stayed in the page's resources and in the full-rewrite save. Every run now unlinks the image and form XObjects that nothing draws from the page-tree resource dictionaries that name them. A name stays when anything drawing through the dictionary uses it with Do: the pages, their annotations' appearances, and every form, tiling pattern, Type 3 glyph and soft mask they reach, with /Resources of their own or not, since a name those don't define is looked up in the page's. Going by name keeps more than it must, never less. Each stream is read once against one decode budget; a page or stream that won't decode, or a spent budget, leaves the dictionary as it is. The page-tree walk is shared with unlink_doomed.