URL to PDF Microservice
41–50 of 95 posts
Re: URL to PDF Microservice
#42Unfortunately, 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
#43I 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.
Re: URL to PDF Microservice
#44I 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://...
That's a good idea! You can achieve this by adding e.g. &pdf.width=1000px&pdf.height=10000px parameters. Sometimes you can get rid of the sticky headers with &emulateScreenMedia=false parameter if the page has well implemented @media print rules in CSS. We decided to use page.emulateMedia('screen') with Puppeteer to make PDFs look more like the actual web page by default. Pages which use lazy loading for images may l…
Re: URL to PDF Microservice
#45Earlier quoted context omitted.
I've moved all my pdf to client side. Less security and processing on the server. http://pdfmake.org/#/gettingstarted
Is there a browser support matrix somewhere? This looks real promising but we need to support IE9. :(
Re: URL to PDF Microservice
#46Re: URL to PDF Microservice
#47Partially off topic: does anybody know of a hosted solution that turns a pdf into an html page, and hosts the output html (optionally, also hosts the pdf, with a downloadable link).
Not sure of more straight forward hosting options
Re: URL to PDF Microservice
#48One 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
#49Took 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…
Edit: this seems to be a take on saving the HTML plus assets - https://github.com/pirate/bookmark-archiver.
Re: URL to PDF Microservice
#50It looks like chrome's javascript interface exposes options that the command line doesn't. Or else I'm overlooking something, because I couldn't find a way to to hide the header and footer (which shows the date, title, url, and page number) using the command line. But this project does hide the header and footer. I can't use an externally hosted service like this because some of my URLs are non-public. So when the us…
Right now, I'm using wkhtmltopdf which supports custom headers and footers and I'm mulling over how to do the same with this solution.