Skip to content
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

--pdf-engine=wkhtmltopdf always fails in pandoc 3.6 #10468

Closed
Choonholic opened this issue Dec 18, 2024 · 4 comments
Closed

--pdf-engine=wkhtmltopdf always fails in pandoc 3.6 #10468

Choonholic opened this issue Dec 18, 2024 · 4 comments
Labels

Comments

@Choonholic
Copy link

To do:
Convert markdown document to PDF applied style.css

Prerequisites
Pandoc 3.6
wkhtmltopdf 0.12.6

Reproducing:

pandoc source.md -f markdown -o dest.pdf --pdf-engine=wkhtmltopdf

Symptoms:
Pandoc 3.5 worked perfectly.

But, Pandoc 3.6 always failed from 1st step like below.

Error: Failed loading page file://toPC54C.source (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1, due to unknown error.
Error producing PDF.`

Unfortunately, --load-error-handling ignore did not help.

Thanks.

@Choonholic Choonholic added the bug label Dec 18, 2024
@jgm
Copy link
Owner

jgm commented Dec 18, 2024

That error message comes from wkhtmltopdf, not pandoc.
If you want to pass --load-error-handling ignore to wkhtmltopdf, you'll have to use this option in pandoc:

--pdf-engine-opt=--load-error-handling --pdf-engine-opt=ignore

@jgm
Copy link
Owner

jgm commented Dec 18, 2024

If it works with pandoc 3.5 (I assume you have tested recently with same wkhtmltopdf version), then perhaps the culprit is this item in the changelog:

    + Use `.source` extension, not `.html`, in `toPdfViaTempFile` (#10314).

@Choonholic
Copy link
Author

Yes, pandoc 3.5 worked perfectly with the same configuration.
I will review the changelog and report the result.

Thanks.

However, passing --pdf-engine-opt parameters did not help.

@Choonholic
Copy link
Author

Choonholic commented Dec 18, 2024

When I use wkhtmltopdf separately, it works as expected. (Both of Pandoc 3.5 and 3.6, wkhtmltopdf 0.12.6)

pandoc -f markdown -o out.html -c style.css --embed-resources --standalone source.md
wkhtmltopdf --enable-local-file-access out.html out.pdf

I absolutely agree the changes by #10314 are the reason of the symptoms.

Tnanks.

@jgm jgm closed this as completed in d6edb57 Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants