Live data from Hacker News

URL to PDF Microservice

github.com

11–20 of 95 posts

Re: URL to PDF Microservice

#11
post #5

Earlier quoted context omitted.

It's using headless chrome, and there is a serverless version of chrome headless (chromeless), so it should be pretty scalable.

A chrome is a chrome... headless chrome uses almost the same resources as a desktop chrome (same engine and all that)

Yes, but that doesn't matter in regards to the question "Is it scalable?" which OP asked.

Re: URL to PDF Microservice

#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

Re: URL to PDF Microservice

#14
post #11

Earlier quoted context omitted.

A chrome is a chrome... headless chrome uses almost the same resources as a desktop chrome (same engine and all that)

Yes, but that doesn't matter in regards to the question "Is it scalable?" which OP asked.

But its no scalable, making it serverless just makes scalable at a huge cost.

Re: URL to PDF Microservice

#15
I was playing around with Puppeteer the other day and was wondering if it was possible to render a web page to a single page PDF (a page with fixed width and variable height). Basically like creating screenshot without losing the text information. This would solve a lot problems such as sticky elements hiding text like in this example [1].

[1]: https://url-to-pdf-api.herokuapp.com/api/render?url=https://...

Re: URL to PDF Microservice

#16
post #11

Earlier quoted context omitted.

Yes, but that doesn't matter in regards to the question "Is it scalable?" which OP asked.

But its no scalable, making it serverless just makes scalable at a huge cost.

You are contradicting yourself.

It is scalable. It scales linearly (and for practical purposes indefinitely) with the amount of money you spend on AWS Lambda. It might not have a nice constant factor, but it is scalable.

Re: URL to PDF Microservice

#17

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!

Re: URL to PDF Microservice

#20
post #2

I wonder how scalable the service is... At least with PhantomJS I felt like my system would begin to lockup if there were too many instances rendering at the same time (and it didn't appear to be an issue of too little memory). Nonetheless, this looks promising.

You need to fire a new chrome headless process every time you create a PDF, its not scalable but it works. I wonder if this part of chrome could be easily extracted as a C++ library.

I suspect that "extracting" this part of chrome into a library would result in the same thing: a library that starts up the full chrome environment and prints a page to PDF.

The PDF-ization isn't the part that's hard to extract (there are libraries to create PDFs from scratch already available, and they're small/intelligible). Rather, it's the rendering of a webpage for display that's the hard part, and what most of the code in any web browser is concerned with. Whether that display is a monitor or a PDF doesn't change much.

Post reply on HN