Reed G. Law Reed G. Law - 2 months ago 5x
Linux Question

PDF display garbled in Chrome

I see this when clicking a link to a PDF stored on Amazon S3 in Chrome:
enter image description here

If I download the same URL using wget or follow the same link in Firefox the PDF displays normally.

It looks like Chrome is not interpreting the file as a PDF. Is the problem with the PDF file or with Chrome? The PDF file was generated by wkhtmltopdf 0.12.3 (with patched qt) on Arch Linux.

Edit: it seems like a problem with the PDF because when I use

to identify the format it returns "data" whereas a normal PDF returns something like "PDF document, version 1.6".


I figured it out. I was using PDFKit to generate PDFs with the verbose option on. The verbose option somehow put all of stdout inside the PDF itself which caused Chrome to not detect the file as a PDF.