TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you generate PDFs?

5 点作者 iBotPeaches大约 6 年前
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 条评论

rexpi0大约 6 年前
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.
jolmg大约 6 年前
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>
jamespaden大约 6 年前
Hi, I&#x27;m a developer at DocRaptor. What about DocRaptor didn&#x27;t work for you?