aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 615 forks source link

non compliant PDF's break all pdf processing #820

Closed agokhale closed 1 year ago

agokhale commented 3 years ago

Certain PDF generators use unfortunate line endings (0x0D) rather than the cannonical ( 0x0A); HP Scan Exended and others are guilty of this behaviour. The underlying ghostscript implementation reports the following errror, but it's not fatal - gs continues to render the file. Error: stream operator isn't terminated by valid EOL. Output may be incorrect. Error: stream operator isn't terminated by valid EOL. Output may be incorrect. The error handling code in gm can't seem to get around this and breaks. I've branched and written a test case that chokes on a crafted, noncompliant pdf that gs really can render

agokhale commented 3 years ago

I've written a filter that eats the '**** Error: stream operator isn't terminated by valid EOL.' from the input stream and allows gm to operate on the noncompliant files test --integration --only pdf-noncompliant. now passes https://github.com/aheckmann/gm/pull/821

agokhale commented 1 year ago

I believe my fix in pr 821(merged) can close this.