Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Creating PDF from HTML on Debian Bookworm; tools?

+2
−0

I am on a Debian Bookworm Docker image. My Rails6 project needs to convert HTML files to PDF. I used to do this with wkhtmltopdf, but wkhtmltopdf has not been supported for a long time now, and I want to update. I have tried using headless Chrome, but this is not a solution since it (a) contains bugs that cause parts of the HTML to be omitted, and there are one-page HTML files that even cause headless Chrome to outright crash; and (b) it's a very, very wonky installation. Right now I can't install headless Chrome on Bookworm because it can't find libasound2:amd64.

What else can I do? I tried Pandoc, but it uses an intermediate library for generating PDFs which I also find pretty wonky... pdfroff doesn't work at all and do I really need to install LaTeX?

I've been requesting my client to use a service provider such as nutrient.io, but as I generate files with confidential data, uploading our HTML files to an unknown destination isn't really something we want either.

History

2 comment threads

Headless Chrome, pandoc (1 comment)
Linux Systems site (1 comment)

2 answers

+3
−0

If you can include more CSS, there are several tools listed under https://print-css.rocks/#heading-11 which helps to get everything printed correctly.

If not, try out https://github.com/plutoprint/plutobook

History

0 comment threads

+2
−0

I originally didn't bother to mention it because I have typically used it from Pandoc, making it equivalent to LaTeX. However, Weasyprint both works as Pandoc's alternative HTML-to-PDF path and runs standalone, as weasyprint input.html output.pdf, plus assorted options if you need something more sophisticated.

History

0 comment threads

Sign up to answer this question »