Live data from Hacker News

URL to PDF Microservice

github.com

71–80 of 95 posts

Re: URL to PDF Microservice

#71
post #48

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.o…

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 c…

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...

Re: URL to PDF Microservice

#72
post #70

OT (maybe) Question: I've gotten more and more annoyed over the years as links are deleted/decay etc. Even more so recently. Is there a plug-in that makes a 'personal archive' or potentially on-sends the page to the Archive. It would be useful to be able to search/go back in my time-line to webpages even if they were just static pdf's.

https://historio.us/referrals/MTExNTM5MjAg/

Re: URL to PDF Microservice

#73
post #60

I would like to adopt something like this, but there are some pretty normal table functions in our current print solution that I don't know how to support in HTML. E.g. on a multi-page invoice, show a sub-total row at the bottom of each page. Does anyone know how to create this kind of function?

Use a element (unless you're actually trying to show a sub-total of just the page you're looking at).

Yeah literally need to add an invoice subtotal for the items on that page

Re: URL to PDF Microservice

#75
post #70

OT (maybe) Question: I've gotten more and more annoyed over the years as links are deleted/decay etc. Even more so recently. Is there a plug-in that makes a 'personal archive' or potentially on-sends the page to the Archive. It would be useful to be able to search/go back in my time-line to webpages even if they were just static pdf's.

Wallabag: a self-hostable application for saving web pages | https://news.ycombinator.com/item?id=14686882 (Jul 2017)

Show HN: Kozmos – A Personal Library | https://news.ycombinator.com/item?id=14980075 (Aug 2017)

specifically: https://addons.mozilla.org/en-US/firefox/addon/scrapbook-x/ and https://chrome.google.com/webstore/detail/worldbrain-the-res...

Re: URL to PDF Microservice

#76

Unfortunately, the "sensible defaults" don't seem to check input URLs correctly and allow file:// URLs. Just try ?url=file:///etc/passwd on the demo instance. That seems to be a quite common issue with services like this built on generic libraries.

Oh wow, that's a bit embarrassing :) The urls are now restricted to http and https only. Thanks for noticing!

This is ripe for an easter egg if you request a file:// URL PDFs support compression, right? I wonder how hardened they are to zip bombs...

Re: URL to PDF Microservice

#77

Earlier quoted context omitted.

Redrawing the PDF's and scanning them would likely not scale linearly with the amount of money you spend on labor. Labor tends to have diminishing marginal returns. The cost of hiring two workers is more than double that of hiring one worker because there is additional complexity in coordinating the workers. Also, for the record, this comment I'm making right now is just pedantic.

As long as the workers do not need to coordinate, it should scale. Round-robin those folks.

If there is only one worker the requests can flow directly to that one worker. If there are two workers, something would need to sit in the middle and determine how to distribute the requests. That extra hop is where the extra complexity comes from.

Re: URL to PDF Microservice

#79

Why use headless chrome instead of the PDF lib used by chrome directly? https://pdfium.googlesource.com/pdfium/

For starter, documentation: you can't even understand what pdfium IS from that page. After some search I see that it can do rasterization, from pdf to e.g. png, but I couldn't find any mention of it being capable to generate the pdf from an url. Can it?

Re: URL to PDF Microservice

#80
post #13

Unfortunately, the "sensible defaults" don't seem to check input URLs correctly and allow file:// URLs. Just try ?url=file:///etc/passwd on the demo instance. That seems to be a quite common issue with services like this built on generic libraries.

I've moved all my pdf to client side. Less security and processing on the server. http://pdfmake.org/#/gettingstarted

Then you can't send pdfs in emails or pre-cache pdfs...
Post reply on HN