Closed egibney closed 2 years ago
I managed to get things working by changing this:
updated_pdf = CombinePDF.new(pdf_path)
to this:
updated_pdf = CombinePDF.load(pdf_path, allow_optional_content: true)
I made this change after reading this comment from the gem's readme
Sometimes the CombinePDF will raise an exception even if the PDF could be parsed (i.e., when PDF optional content exists)... I find it better to err on the side of caution, although for optional content PDFs an exception is avoidable using CombinePDF.load(pdf_file, allow_optional_content: true).
updated_pdf = CombinePDF.new(pdf_path)
When I run the above code I'm getting the follow error for one specific PDF file only:
I can't share the PDF file here because of its copyright status, but happy to share privately with anyone who may be able to help.
If I open the PDF file in Preview on my Mac and "export as PDF" the resulting file works fine.
The "encoding software" of the offending file is Mac OS X 10.10.2 Quartz PDFContext The "content creator" of the offending file is Final Draft 9