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.

Show HN: Ready-to-use API to convert any web page to PDF using headless Chrome

129 pointsby jancurnover 7 years ago

15 comments

conradkover 7 years ago
Saving a webpage to a PDF is literally one command line away:<p>chromium --headless --disable-gpu --print-to-pdf=google.pdf <a href="http:&#x2F;&#x2F;google.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;google.com&#x2F;</a><p>What does Apify add in this case?
评论 #15611774 未加载
评论 #15612133 未加载
评论 #15611784 未加载
评论 #15611946 未加载
评论 #15616701 未加载
评论 #15611744 未加载
评论 #15612567 未加载
jottoover 7 years ago
I&#x27;ve been working on something similar: <a href="https:&#x2F;&#x2F;www.prerender.cloud&#x2F;docs&#x2F;api" rel="nofollow">https:&#x2F;&#x2F;www.prerender.cloud&#x2F;docs&#x2F;api</a><p><pre><code> &#x2F;&#x2F; URL to screenshot service.prerender.cloud&#x2F;screenshot&#x2F;https:&#x2F;&#x2F;www.google.com&#x2F; &#x2F;&#x2F; URL to pdf service.prerender.cloud&#x2F;pdf&#x2F;https:&#x2F;&#x2F;www.google.com&#x2F; &#x2F;&#x2F; URL to html (prerender) service.prerender.cloud&#x2F;https:&#x2F;&#x2F;www.google.com&#x2F;</code></pre>
评论 #15612439 未加载
评论 #15616229 未加载
visargaover 7 years ago
By the way, is there an opposite service that converts PDF&#x27;s into plain HTML for reading? I know about <a href="https:&#x2F;&#x2F;www.arxiv-vanity.com&#x2F;papers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.arxiv-vanity.com&#x2F;papers&#x2F;</a> but it only works on arXiv PDFs.
评论 #15612085 未加载
评论 #15612138 未加载
评论 #15613301 未加载
jugjugover 7 years ago
Off-topic, but Apify as a service looks really good. I was spinning up a dedicated VM on AWS with Docker installed only to get a simple webscraper running. Apify solves this elegantly and removes an significant pain in my workflow.
ak39over 7 years ago
Any info how this compares to commercial html to pdf renderers like PrinceXML?
评论 #15614757 未加载
评论 #15614549 未加载
评论 #15616919 未加载
dmmalamover 7 years ago
Also check out <a href="https:&#x2F;&#x2F;urlbox.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;urlbox.io&#x2F;</a>. YC alum, super helpful.
laktekover 7 years ago
I built Screen.rip, which also supports PDF generation. <a href="https:&#x2F;&#x2F;screen.rip&#x2F;#pdf" rel="nofollow">https:&#x2F;&#x2F;screen.rip&#x2F;#pdf</a><p>Screen.rip gives you more control over the generated PDF beyond Puppeteer&#x27;s options (like it can wait for certain elements to appear, inject CSS or switch to screen stylesheet instead of the print stylesheet).
phmagicover 7 years ago
I love this service! I think ease of adoption you can allow pre-made scripts to be shared so the non-technical can easily set up work flows that go right into their email. For the technical folks, I think it would be great to have examples of things you can do with Apify that is a hassle to do with your local chrome headless.<p>Great job!
nikisweetingover 7 years ago
If you&#x27;re interested in running your own personal Way-Back machine that uses Chrome headless for archiving (among other methods), check out Bookmark Archiver.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;pirate&#x2F;bookmark-archiver" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pirate&#x2F;bookmark-archiver</a>
sebazzzover 7 years ago
We are not too happy with our EvoPDF license so in the basis this is a good option. However, I do not think this allows adding headers, footers, page numbers etc.
jeppebemadover 7 years ago
Is there a similar API around that accepts HTML instead of a URL? I’ve build one for my project, but I would prefer to delegate this to an external service.
评论 #15615192 未加载
评论 #15614824 未加载
评论 #15614978 未加载
Robdel12over 7 years ago
Question: does this create accessible PDFs? That would be a really nice _possible_ work around for screen reader users having issues with a website.
评论 #15619035 未加载
tehlikeover 7 years ago
you could rpobably launch this service free, and someone will probably create a docker image, and make it one click.
colordropsover 7 years ago
As long as GPU support is not functional in headless, &quot;any web page&quot; is a misnomer. A large enough percentage of sites use GPU acceleration so that headless mode is useless. This needs to be addressed by the Chrome team.
评论 #15613375 未加载
评论 #15614392 未加载
panda888888over 7 years ago
Does this work if the page is behind a password&#x2F;SSO wall?<p>And is it possible to print multiple Chrome tabs?<p>Printing pages to PDF is pretty straightforward. It&#x27;s the above two issues were I&#x27;ve run into problems. Anyone know of a good solution to the second one?
评论 #15615253 未加载
评论 #15615969 未加载
评论 #15615356 未加载
评论 #15616206 未加载