TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do you generate PDFs?

5 pointsby iBotPeachesabout 6 years ago
Given a complicated view mixed of HTML &amp; various JavaScript widgets that range from SVG to canvas. How do companies make beautiful PDF reports?<p>Started with wkhtmltopdf, then started investigating the SASS industry like DocRaptor and the parent PrinceXML.<p>Started messing with headless Chrome to just take screenshots of the widgets and combine those images into a PDF, but its quite hacky.<p>What do people do in situations like this?

3 comments

rexpi0about 6 years ago
Where we can, we use LaTeX templates. In other places we use Python to generate Word (python-docx) or PowerPoint presentations (python-pptx).<p>A few years ago I had success generating WYSIWYG PDFs using HTML5 and the printable classes in CSS Bootstrap (<a href="https:&#x2F;&#x2F;getbootstrap.com);" rel="nofollow">https:&#x2F;&#x2F;getbootstrap.com);</a> in that particular case I used CherryPy (<a href="https:&#x2F;&#x2F;cherrypy.org" rel="nofollow">https:&#x2F;&#x2F;cherrypy.org</a>) under IIS and sent the rendered HTML to pdfkit (<a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;pdfkit&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;pdfkit&#x2F;</a>) to generate PDFs. That was preferred over relying on the user to print to the page to PDF from their web browser.
jolmgabout 6 years ago
There are libraries like ruby&#x27;s prawn[1].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;prawnpdf&#x2F;prawn" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;prawnpdf&#x2F;prawn</a>
jamespadenabout 6 years ago
Hi, I&#x27;m a developer at DocRaptor. What about DocRaptor didn&#x27;t work for you?