Closed zeeshan-nimonik closed 6 months ago
The file itself is not valid. If you run hexapdf info --check input.pdf
it will tell you that there are problems with the file. The field /BG should only have dictionaries or streams as values but in your case it has a symbol as value. You can inspect the value using hexapdf inspect input.pdf 17
.
You can turn validation off when writing using the validate
argument. However, if you do that you also might wanna run the validation yourself using content.validate
which will do the validation, auto-correct problems if possible but not throw any errors.
I am encountering an issue with processing some PDFs using my code. HexaPDF::Error - Validation error for (17,0): Type of field BG is invalid: Symbol:
Below is the code snippet I am using:
The issue arises when the code reaches the content.write(file) line, and it throws an error.
Could you please review the code and help me resolve this issue? Here is the sample input.pdf
Thank you for your assistance.