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

Change default pdf-engine for HTML from wkhtmltopdf to weasyprint #10142

Closed
jgm opened this issue Sep 2, 2024 Discussed in #10132 · 3 comments
Closed

Change default pdf-engine for HTML from wkhtmltopdf to weasyprint #10142

jgm opened this issue Sep 2, 2024 Discussed in #10132 · 3 comments

Comments

@jgm
Copy link
Owner

jgm commented Sep 2, 2024

Discussed in #10132

It seems that wkhtmltopdf has been deprecated (the underlying engine is ancient).

We should change the default --pdf-engine for HTML to pagedjs-cli or weasyprint.
Consensus is that weasyprint is lighter weight and easier to install, so it's probably a better default.

Possible drawbacks: breaking existing workflows that rely on wkhtmltopdf.

@jgm
Copy link
Owner Author

jgm commented Sep 2, 2024

I must say that pagedjs-cli gives much better results.

weasyprint with pandoc manual:

Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)
WARNING: Ignored `text-rendering: optimizeLegibility` at 15:7, unknown property.
WARNING: Expected a media type, got '(max-width: 600px)'
WARNING: Invalid media type ' (max-width: 600px) ' the whole @media rule was ignored at 18:5.
WARNING: Ignored `overflow-x: auto` at 112:7, unknown property.
WARNING: Ignored `gap: min(4vw, 1.5em)` at 149:32, invalid value.
WARNING: Ignored `overflow-x: auto` at 150:28, unknown property.
WARNING: Ignored `user-select: none` at 187:32, unknown property.
WARNING: Anchor defined twice: 'footnotes'

and then it looks like this:
Screenshot 2024-09-02 at 9 23 16 AM

pagejs-cli:

✔ Loaded
✔ Rendering 146 pages took 2537.7000000178814 milliseconds.
✔ Generated
✔ Processed
✔ Saved to /Users/jgm/src/pandoc/toPdfViaTempFile61952-1.pdf

and it looks just like it looks in the browser:
Screenshot 2024-09-02 at 9 24 06 AM

@jgm
Copy link
Owner Author

jgm commented Sep 2, 2024

Maybe I'd rather stay with wkhtmltopdf than default to weasyprint, which seems to ignore the font size...

@bpj
Copy link

bpj commented Sep 2, 2024

The problem with staying with wkhtmltopdf is that package managers will eventually stop providing packages for it. WeasyPrint output may leave something to be desired if you have not-so low demands,[^1] but it is maintained, it is widely provided by package managers so relatively easy to install, it is relatively lightweight, and those who have higher demands can always use an alternative.

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

No branches or pull requests

2 participants