gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.22k stars 69 forks source link

Error: "Problem while decoding Flate encoded stream: incorrect header check" #162

Closed earthlingworks closed 2 years ago

earthlingworks commented 2 years ago

Hi Thomas! We're seeing a specific error with a PDF:

HexaPDF::FilterError (Problem while decoding Flate encoded stream: incorrect header check)

The script to duplicate:

require 'hexapdf'

puts 'File open'
document = HexaPDF::Document.open(ARGV[0])
puts 'File write'
document.write('/tmp/test1', validate: false, optimize: true)

puts 'File 2 open'
document1 = HexaPDF::Document.open('/tmp/test1')

I'll send an email with the PDF for you to troubleshoot with. Thanks!

gettalong commented 2 years ago

Thanks for the bug report and the file!

I have discovered the problem and along another bug or two and some places where things could be improved. Will fix this and do a release because the original problem is quite severe as it leads to corrupted files.

earthlingworks commented 2 years ago

Ok, good to know and thanks!

gettalong commented 2 years ago

@earthlingworks I have just released 0.18.0 with the fix!