Skip to content

Xobject rendering support#5

Open
sam-shubham wants to merge 3 commits intoOpenPrinting:mainfrom
sam-shubham:xobject-rendering-support
Open

Xobject rendering support#5
sam-shubham wants to merge 3 commits intoOpenPrinting:mainfrom
sam-shubham:xobject-rendering-support

Conversation

@sam-shubham
Copy link
Copy Markdown

Add JPEG (DCTDecode) XObject rendering support

Implement image XObject handling in the parser and Cairo backend.
Detect Do operators, resolve XObject resources, and dispatch Image
and Form subtypes. Introduce a device_draw_image() entry point for
rendering.

Replace unsupported pdfioObjGetStream usage with pdfioObjOpenStream
and buffered pdfioStreamRead to avoid nested stream issues. Decode
JPEG (DCTDecode) image data, convert it into a Cairo image surface,
and render it with correct PDF coordinate orientation.

Update content stream handling to safely process Do by closing the
active page stream before opening XObject streams. Add basic testing
with image-based PDFs.

Test

Single Image Pdf

 ./source/tools/pdf2cairo/pdf2cairo -o out.png testfiles/input/xobject/simpleImage.pdf

Multi-Image Pdf

./source/tools/pdf2cairo/pdf2cairo -o out.png testfiles/input/xobject/two-images-same-page.pdf

Preview

PDF with single image
out2

PDF with multiple image
out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant