ajaxray/markpdf

invalid media box causes output to be all blank

allchannelson opened this issue · 2 comments

I have a PDF file that seems to have an invalid media box. The file opens fine using Adobe PDF reader, so I assume there's a standard default being used.

I can't provide the original file since it has sensitive information on it, and when I edit it, it "corrects" for the error.

I do I have a verbose output capture, and I can provide the output PDF.

markpdf bad.pdf "Test" bad_output.pdf --opacity=1 --font-size=12 --offset-x=10 --offset-y=10 -v
2023/01/03 14:30:05 Input PDF: bad.pdf
2023/01/03 14:30:05 No file exists at: Test, assuming Text Watermark.
[DEBUG]  parser.go:1530 Pdf version 1.7
[DEBUG]  main.go:131 Failed to get page mediabox: Invalid media box
2023/01/03 14:30:05 Page Width       : 0
2023/01/03 14:30:05 Page Height      : 0
2023/01/03 14:30:05 Paragraph width: 19.450000
2023/01/03 14:30:05 Paragraph height: 10.000000
2023/01/03 14:30:05 Offsets x: 10.000000, y: 10.000000

bad_output.pdf

I'll see if I can get the source code to work and hard-code some values and see if that makes a difference.

Same problem here,
With some of the pdfs i get a blank page.
Any method to resolve this?

I've solved it by creating an action to fix the mediabox.
I've used setasign/Fdpi for this.