gettalong / hexapdf

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

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

Closed earthlingworks closed 1 year ago

earthlingworks commented 1 year ago

Hey Thomas! This is an issue we're actually getting semi regularly with multiple customers on v 0.27

Seems to happen when writing the file with HexaPDF and then reading the same file with HexaPDF.

(I was supposed to submit this last week and completely got side tracked, so my fault for not submitting it sooner.)

require 'hexapdf'
​
file = File.open(ARGV[0])
​
output_path = 'output.pdf'
​
hexapdf_document = HexaPDF::Document.new(io: file)
​
hexapdf_document.write(output_path, validate: false, optimize: true)
​
file2 = File.open(output_path)
​
hexapdf_document2 = HexaPDF::Document.open(file2)

I'll send an email with the PDF. Thanks!

gettalong commented 1 year ago

When I run your script with the provided file, I get no error. Note, however, that I'm using the latest version of HexaPDF which has a few fixes that might be applicable here. Could you upgrade to 0.28.0 and see if it works for you?

earthlingworks commented 1 year ago

Oh yeah, the error only happens in 0.27, not 0.28…but Nelson on our team was looking at 0.28 and ran into a couple of bugs and noticed that it didn't seem to be officially released yet (?) so figured those bugs were being worked out. I'll ask about the specific issues he ran into.

gettalong commented 1 year ago

It is officially released so if you ran into any bugs, yes, please ask him :grin:

What I just fixed is the changelog listing at https://hexapdf.gettalong.org/documentation/changelog.html which didn't have the correct version/date information there. But otherwise it is released normally. Sorry for the inconvenience!

earthlingworks commented 1 year ago

Oh gotcha. Yeah, so Nelson said it wasn't an issue with HexaPDF that he ran into (I misunderstood), just breaking changes so updates we have to make on our own code. He's working on that and we'll just move to that version, so I think we're all set on this one. Thanks!

gettalong commented 1 year ago

Let me know if there is anything!

FYI: The next version will also have a few breaking changes in the digital signature handling code but after that it should quiet down a bit.

earthlingworks commented 1 year ago

All good. Updated and no issues in testing after our code changes. We'll be releasing it tomorrow.

Cool, thanks for the heads up on next version!