Live data from Hacker News

Show HN: Simple PDF to PNG Server

secureview.cloudbrowser.xyz

31–40 of 58 posts

Re: Show HN: Simple PDF to PNG Server

#31
post #15

Earlier quoted context omitted.

Just a digital ocean droplet running FreeBSD, then PM2 running Node.JS and ImageMagick built with multicore support.

ImageMagick with "multicore" support won't speed things up the moment number of concurrent requests touches the number of cores you have. And in digital ocean's case you have only one core.

But remember that multi-threading was shown to improve performance in the era of single-core computers.

Re: Show HN: Simple PDF to PNG Server

#32
post #29

Actually it just uses ImageMagick and soffice under the hood, so it can do way more than PDF. I've tested it with DOC, DOCX, XLS, and they all seem to work. Edit: in case anyone wants an example, here's the conversion of tesla-model-s.pdf[0]: https://secureview.cloudbrowser.xyz/uploads/filekat9.v05lnle... [0]: https://www.tesla.com/sites/default/files/tesla-model-s.pdf

Does it support SVG?

as an output format?

Re: Show HN: Simple PDF to PNG Server

#33

Earlier quoted context omitted.

My experience is relatively small. The `convert` script of ImageMagick calls soffice by default if the input file is a LibreOffice type. I actually started writing a shell script to detect if it was DOCX etc, and run soffice first, but then I found out that ImageMagick does that automatically, if libreoffice is installed.

hmm, OK, I didn't know that. Thanks that's useful :) Be interesting to see how your demo site holds up under HN front page traffic - I know Imagemagic is used a lot for random web sites, but I worry about scale a lot. Any info would be useful!

no probs. if you want to email me I can let you know once it all quiets down.

Re: Show HN: Simple PDF to PNG Server

#34

Earlier quoted context omitted.

hmm, OK, I didn't know that. Thanks that's useful :) Be interesting to see how your demo site holds up under HN front page traffic - I know Imagemagic is used a lot for random web sites, but I worry about scale a lot. Any info would be useful!

no probs. if you want to email me I can let you know once it all quiets down.

sent :)

Re: Show HN: Simple PDF to PNG Server

#35
post #25

Earlier quoted context omitted.

OK, that's a good point. I think the only reason was I looked at PDF.js and felt the quality was not so good, and then I tried ImageMagick and found it gave good quality, so I just went with that. Another reason is I made this to convert the PDF (or Word doc, XLS, etc) remotely without the file ever touching the user's device. So they couldn't be exposed to any exploits contained in the file or of the PDF engine (PDF…

"to convert the PDF (or Word doc, XLS, etc) remotely without the file ever touching the user's device" This made me think that the site accepts a URL to a PDF/XLS/DOC file and returns PNG.

It sounds like that makes you think the site accepts a link to a PDF/XLS/DOC and returns a PNG.

Actually, that is basically what happens in the original context for this service.

If you take a look at

https://free.cloudbrowser.xyz

open a remote browser, then search for a PDF/XLS/DOC etc and then click on it, you'll see a dialog which says the file is transferred.

What's happening is the remote browser downloads the file to a temp directory in the cloud, then some software does a POST request with that file to the service (Simple PDF to PNG Server) and gets the viewing link back immediately, before the conversion has completed.

It then sends the viewing link back to the remote browser which opens a tab. The client can then view the document as images securely without the file ever touching their device.

Originally, I didn't intend to release this viewer as a separate thing/product/service.

If you use the viewer (without the remote browser) you do have to submit the file. I didn't make it to fetch them. I made it as a "secure document viewer" for the remote browser product.

Re: Show HN: Simple PDF to PNG Server

#37
post #11

With superb open source, cross platform libraries like pdfium available to the public, why won't I just do this on the client?

I used PDF.js in a side project for comparing pdfs and it worked quite well. It runs completely client side, so I can build the site with a static site generator and html: https://www.parepdf.com/

It can start to bog down with large image heavy pdfs. But overall it runs performantly.

Re: Show HN: Simple PDF to PNG Server

#39

Actually it just uses ImageMagick and soffice under the hood, so it can do way more than PDF. I've tested it with DOC, DOCX, XLS, and they all seem to work. Edit: in case anyone wants an example, here's the conversion of tesla-model-s.pdf[0]: https://secureview.cloudbrowser.xyz/uploads/filekat9.v05lnle... [0]: https://www.tesla.com/sites/default/files/tesla-model-s.pdf

what's your experience running soffice server-side? I might have to do this soon, and I'm dreading it.

It's actually not too bad. You can run a pool of soffice processes, but unless you really care about the startup time, I'd suggest running individual processes per job, which you can run headless from the command line. For the most part libreoffice does well, although at some point you'll start to discover the quirks in their rendering...

Re: Show HN: Simple PDF to PNG Server

#40
post #15

Earlier quoted context omitted.

Just a digital ocean droplet running FreeBSD, then PM2 running Node.JS and ImageMagick built with multicore support.

ImageMagick with "multicore" support won't speed things up the moment number of concurrent requests touches the number of cores you have. And in digital ocean's case you have only one core.

Sure, but if your concurrent number of fully tendered requests at least sometimes dips below the number of cores, it is a big win.

(At the possible cost of top-end scale; improving response to normal workload significantly and hurting the top workload reachable somewhat).

Post reply on HN