Skip to content

fix tiff parsing in CCITTFactory.extractFromTiff method - #508

Open
valerybokov wants to merge 1 commit into
apache:trunkfrom
valerybokov:fix-CCITTFactory.extractFromTiff-method
Open

fix tiff parsing in CCITTFactory.extractFromTiff method#508
valerybokov wants to merge 1 commit into
apache:trunkfrom
valerybokov:fix-CCITTFactory.extractFromTiff-method

Conversation

@valerybokov

@valerybokov valerybokov commented Aug 29, 2026

Copy link
Copy Markdown

GROUP3OPT_BYTEALIGNED (bit 3, value 8) is silently ignored.
The tag-292 block never checks val & 8. But COSName.ENCODED_BYTE_ALIGN ("EncodedByteAlign") is a real, wired-up PDF DecodeParms key — CCITTFaxFilter.java:61 reads it (default false) and passes it straight to CCITTFaxDecoderStream. Since extractFromTiff copies the compressed bytes through unmodified, if the source TIFF was Group-3-encoded with byte-aligned rows, the resulting PDF needs /EncodedByteAlign true in its DecodeParms to decode correctly. Currently that flag is never set, so any such TIFF would produce a PDF image that decodes with progressively misaligned rows (visually corrupted/garbled output).

@THausherr

Copy link
Copy Markdown
Contributor

It's bit 2:
grafik

@THausherr

THausherr commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Also here
https://web.archive.org/web/20121016061030/https://www.awaresystems.be/imaging/tiff/tifftags/t4options.html

There's a tiff file here:
https://issues.apache.org/jira/browse/PDFBOX-934

I notice that the error messages in the existing code are switched.

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.

2 participants