简体   繁体   中英

Generated PDF corrupt using wkhtmltopdf with firefox - fine on chrome

We (my work) use wkhtmltopdf to generate PDFs for exporting the data the user has selected in my php web application. This works fine when using the application in chrome, and for both methods we use for generation (using pipes the other writing to disk). However when using firefox both methods generate a corrupt pdf.

I have tested this on both browsers on about 4 separate instances of our app server and the results are the same. Only once did it work in firefox, but straight after it worked i couldn't replicate it again!

I also tried in IE11. Any help or ideas will be greatly appreciated :)

Update

Tested as working in these browsers

  • IE11
  • IE10 - F12 Dev tools
  • IE 9 - F12 Dev tools
  • Opera 26
  • Safari
  • Latest Chrome

Cant see any issues with encoding and both requests appear identical. No issues with SPDY according to a colleague.

We managed to fix this by making sure the content length header was being set during the application shutdown to get the correct value. For some reason it affected gzip which was enabled through spdy.

header('Content-Length: ' . strlen($pageContents), true);

Have you checked what is sent to the server in both cases? May there be an encoding problem?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM