boazsegev / combine_pdf

A Pure ruby library to merge PDF files, number pages and maybe more...
MIT License
733 stars 154 forks source link

Web optimized PDFs improperly parsed #225

Open ndvo opened 1 year ago

ndvo commented 1 year ago

When parsing a file that was web optimized the resulting root_object contains only :Size and :ID.

Steps to reproduce:

Select a PDF file and optimize it for the web:

   file = CombinePDF::PDFParser.new(value.read, allow_optional_content: true)
   file.parse
   file.root_object

Result will be something like:

{:Size=>6, :ID=>["\x00\x00\x00...\x00", "19v\x00\x00...\x00"]}