News for hackers. Stuff that matters.
Re:URL to PDF Microservice by danso on Thursday October 05, 2017 @02:32PM (#15411467)
Took a quick skim of the README. I have a general question for these web-to-PDF services. Is the priority to honor the page styles as set forth in a print.css-type file? Or is it to be as close as a screenshot as possible of a webpage, which is what I think the majority of laypeople would expect.

One of the small things I've recently let myself be bothered by is how divergent HTML/browser snapshots from web.archive.org, archive.is, and Google cache can be, even for relatively simple pages. I've already given up on trying to make (not even sure if it's a good idea) HTML look nice as PDFs.

Re:URL to PDF Microservice by zerkten on Thursday October 05, 2017 @02:44PM (#15411572)
This service seems to be targeted at producing controlled artefacts from your application (e.g. invoices) where you know what CSS is in use. If you wanted to capture the original design of the page you can use headless Chrome to capture screenshots automatically (https://medium.com/@dschnr/using-headless-chrome-as-an-autom...). Perhaps headless Chrome can also save the HTML plus assets, or some other archive format that would be interactive.

Edit: this seems to be a take on saving the HTML plus assets - https://github.com/pirate/bookmark-archiver.

Re:URL to PDF Microservice by ge96 on Thursday October 05, 2017 @04:05PM (#15412181)
I think phantomjs is another option. I'm personally looking for a way to screenshot charts produced on a site of mine so I can create thumbnails for a quick preview. I think phantomjs is what I will try first.

Edit: ahh someone else mentioned it too.

Re:URL to PDF Microservice by j_s on Friday October 06, 2017 @09:41AM (#15416686)
Nice find on the bookmark-archiver tool; thanks for sharing!
Re:URL to PDF Microservice by kimmobru on Thursday October 05, 2017 @04:43PM (#15412442)
I have been aiming for default settings which would render the site as you see it (screenshot style), but so that you can switch the settings to honor @media print CSS rules.

One of the biggest values I think this yet-another-PDF-service has is that if you open the print preview on a desktop Chrome, it should be really close to what the API renders. Should make debugging a bit easier.

The main use case is to render content generated by yourself, e.g. receipts and invoices, but I don't see a reason why it couldn't be used for rendering news or blog articles.

Re:URL to PDF Microservice by gildas on Thursday October 05, 2017 @06:57PM (#15413200)
If PDF is not really important for you and HTML is fine, take a look at SingleFile [1]. This is a Chrome extension I wrote some years ago to save a page and all its resources in a HTML file.

[1] https://chrome.google.com/webstore/detail/singlefile/mpiodij...