Repository navigation
Conversation
Image, color space, soft mask and form decoding still went back to the raw (dictionary, objects) lookup API. They are now FromPdfObject impls read through the context APIs. Inline images and image XObjects merge into one PdfImage: a FromPdfObject decoder that reads ImageMetadata and the filtered ImagePayload from a stream, and decode(soft_mask) for the raster. Inline images are read by wrapping their normalized dictionary and data in an encoded stream. read_xobject, decode_inline_image, decode_normalized_image and decode_data_with_access are removed. ImageMetadata builds its value in one pass instead of filling ImageEntries, and Resource marks an image unavailable through PdfImage::is_unreadable instead of a raw size check. Filter and image errors keep their type across reads. ColorSpace matches device names in its decoder and reads the Indexed, Separation and DeviceN families with context.read. Colorant names and the Indexed lookup are read with array.at. SoftMask reads /S as a MaskMode, checks that /G is a form XObject stream, and reads /TR as a MaskTransfer, which is Identity or a sampled table. XObjectSubtype decodes /Subtype directly. Rect and Transform gain FromPdfObject decoders, which form and pattern use for /BBox and /Matrix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conformance readsDocuments that Safe-PDF reads differently from the base commit, compared with PDFium. A read pdf.js corpus1009 documents compared with Improvements
840 documents of the PDFium corpus read as on Details are in the job summaries of the workflow run. Rerun a case locally with |
The operator backend traits (twelve per-category traits plus the PdfOperatorBackend supertrait) had one production implementor, PdfCanvas, and a test-only recorder that rebuilt a near-copy of PdfOperatorVariant. Nothing was generic over a single category trait, so the layer only added indirection over an enum that already describes every operator. PdfCanvas now dispatches through apply_operator, and its handlers are inherent methods. Tests check the parsed operators directly instead of replaying them through the recorder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A soft mask's /G group can be the form whose resources are being decoded. Reading its subtype eagerly through the reference pushed that form onto the active path again and failed with a cyclic reference. Check the kind and subtype on the resolved value instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch content stream operators by matching on PdfOperatorVariant
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Image, color space, soft mask and form decoding still dropped back to the raw
(dictionary, objects)lookup API. They now go throughFromPdfObjectand the context APIs.PdfImage.FromPdfObjectdecoder forImageMetadataplus the filteredImagePayload, withdecode(soft_mask)producing the raster. Inline images are read by wrapping their normalized dictionary in an encoded stream.read_xobject,decode_inline_image,decode_normalized_image,decode_data_with_accessandImagePayload::decode.ImageMetadatabuilds its value in one pass instead of fillingImageEntries.Resourcemarks an image unavailable throughPdfImage::is_unreadableinstead of a raw size check.ColorSpacematches device names in its decoder and reads the Indexed, Separation and DeviceN families withcontext.read. Colorant names (nowArc<[u8]>) and the Indexed lookup are read witharray.at./Sis read as aMaskMode,/Gmust be a form XObject stream, and/TRis read asMaskTransfer(Identityor a sampled table).XObjectSubtypedecodes/Subtypedirectly.RectandTransformgain decoders, which form and pattern use for/BBoxand/Matrix.Behaviour changes
InvalidImageDimensions. Image XObjects with them are still unavailable.JPXDecodeimage is still rejected. It is now detected after the filters beforeJPXDecodehave run, and the codestream itself is never decoded./BBoxis treated as absent, so the form is unclipped./Matrixand a tiling/BBoxwith extra trailing numbers are accepted./Gwith an unknown subtype reportsUnsupportedXObjectSubtype.Testing
cargo fmt --checkandcargo clippy --all --workspaceare clean.cargo testpasses for pdf-filter, pdf-image, pdf-resources, pdf-canvas, pdf-parser, pdf-content-stream, pdf-content-stream-operators, pdf-object-collection, pdf-color-space, pdf-object-reader and pdf-graphics.🤖 Generated with Claude Code