添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
稳重的煎饼  ·  Ошибка 429·  4 月前    · 
会搭讪的饭盒  ·  remote ...·  5 月前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While trying to process a PDF, I got the error HexaPDF::FilterError (Problem while decoding Flate encoded stream: buffer error)

I used the code snippet below:

class SampleProcessor < HexaPDF::Content::Processor
  attr_reader :text
  def initialize()
    super()
    @text = ['']
  def show_text(str)
    @text << decode_text(str)
  alias :show_text_with_positioning :show_text

I found that when I performed the following:

reader = HexaPDF::Document.new(io: io)
  processor = SampleProcessor.new
  reader.pages.each do |page|
    page.process_contents(processor)

The error would manifest. The PDF file I used is attached. My apologies if this is something easily addressed. I do not have a deep understanding of the gem.
OriginationDocuments-20190514.pdf

Thanks for providing the faulty PDF file and sample code which helped a lot in figuring out the problems.

So, the problem with the AES encrypted string is really a problem with the file itself. However, I have still implemented a work-around for this kind of problem to make HexaPDF more resilient.

I also found the problem with the Flate encoded stream that is the root cause of your error message. This is also an error with the file itself because an empty stream was encoded incorrectly. I have implemented another work-around for this problem.

Will release a bug fix version with the fixes later!