-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export fails on initial request with "ContentNotFoundError" from wkhtmltopdf #2
Comments
Ok, it's not the piping to stdout that's the issue but looks like an error in wkhtmltopdf caused by having certain kinds of content in the HTML. We're not the only ones! See wkhtmltopdf/wkhtmltopdf#2051. Updated title to reflect this change. |
The cause is one or more of the following:
We can "fix" the first two points with string manipulation, but we can't do anything about broken links in the page. It looks like a combination of one or more of those things causes the PDF generation to fail with an error message on the first attempt. It still generates a PDF but there's no guarantee that it would look the same as you'd expect it to. I don't think we can fix this problem. There's 70 others on this GitHub issue complaining about the same problem, and it hasn't been acknowledged or fixed in 3 years so I don't expect it will be. wkhtmltopdf/wkhtmltopdf#2051 Our options:
|
Further - regression tested against CWP 1.x:
Since it affects the CWP 1.x equivalent code as well, I'm going to reduce the impact slightly and treat it as non-blocking for release. This affects script and stylesheet references that don't exist, but we should be able to expect a lower number of these, since they're generally critical for a website to function. 404s in content would be more concerning, but that's not a problem. |
For clarity, the |
From #1:
Noted issue: clicking the "Export to PDF" link for a page initially fails with this message:
Subsequent requests succeed and open the PDF.
I suspect this could be a macOS issue with piping the wkhtmltopdf output to stdout. We could write it to the PHP temp dir instead of piping to stdout.
To reproduce:
You can clear the PDF generated on initial load via
vendor/bin/sake dev/tasks/CleanupGeneratedPdfBuildTask
which will allow you to continue to reproduce the initial PDF export page load with the error, while running this task afterwards each time.The text was updated successfully, but these errors were encountered: