News for hackers. Stuff that matters.
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @10:41AM (#21545711)
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

Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @02:25PM (#21547902)
Sorry, I'm afraid I just cleaned the upload directory. HN, you have converted 1.6G of files.

Here's that Tesla example link again:

https://secureview.cloudbrowser.xyz/uploads/file5rc5.9nhts2j...

Re:Show HN: Simple PDF to PNG Server by slowenough on Saturday November 16, 2019 @03:21AM (#21551607)
Forgive me, I've cleaned the uploads directory again. Over 3.5G of files converted.

Here's that Tesla link (I'm making it permanent now):

https://secureview.cloudbrowser.xyz/uploads/filecp9z.ohbtt6u...

Re:Show HN: Simple PDF to PNG Server by umvi on Monday November 18, 2019 @10:00AM (#21564782)
Sounds like you need to auto-clean your uploads directory
Re:Show HN: Simple PDF to PNG Server by FreeHugs on Friday November 15, 2019 @10:57AM (#21545838)
Nice. What is your tech stack to serve it?
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @11:00AM (#21545880)
Just a digital ocean droplet running FreeBSD, then PM2 running Node.JS and ImageMagick built with multicore support.
Re:Show HN: Simple PDF to PNG Server by kodablah on Friday November 15, 2019 @05:32PM (#21549444)
One wonders if you can WASM-ify ImageMagick and the use a JS FileReader and a canvas or other PNG output approach to do this all client side. Hrmm, I might tackle this myself if I get the time...
Re:Show HN: Simple PDF to PNG Server by johnsonjo on Saturday November 16, 2019 @02:19AM (#21551469)
Looks like someone has gotten pretty far WASM-ifying ImageMagick already [1]!

[1]: https://github.com/KnicKnic/WASM-ImageMagick

Re:Show HN: Simple PDF to PNG Server by z92 on Friday November 15, 2019 @11:19AM (#21546075)
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.
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @11:23AM (#21546116)
Actually I created a Droplet with 6 cores
Re:Show HN: Simple PDF to PNG Server by Koshkin on Friday November 15, 2019 @12:25PM (#21546712)
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 by mlyle on Friday November 15, 2019 @02:21PM (#21547861)
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).

Re:Show HN: Simple PDF to PNG Server by dandanio on Friday November 15, 2019 @10:58AM (#21545854)
Github? I would love to contribute.
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @11:04AM (#21545926)
Yep, I just put it up now

https://github.com/crislin2046/p2.

Re:Show HN: Simple PDF to PNG Server by michaelmior on Friday November 15, 2019 @11:14AM (#21546015)
Note that HN (and probably many others) won't correctly autolink URLs with a period at the end. It's also somewhat confusing. You may want to consider removing it.
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @11:20AM (#21546082)
Oh! Sorry. Let me change that

http://tiny.cc/p2github

edit: I like the dot ¯\_(ツ)_/¯

Re:Show HN: Simple PDF to PNG Server by yegle on Friday November 15, 2019 @03:23PM (#21548376)
Package it as a docker image and you can then run it on cloud.run (Might be expensive though).

Disclaimer: I work for Google Cloud.

Re:Show HN: Simple PDF to PNG Server by slowenough on Saturday November 23, 2019 @09:21AM (#21614216)
Hey, this is actually atop FreeBSD so it is not as simple as just making a Dockerfile.

It should be too much tho, perhaps just making an install_deps.sh script alternative to use apt, and writing a Dockerfile.

You're welcome to submit a PR but I might get to it first.

Edit: I just made some changes relating to this, including a Dockerfile. I have not tested in Docker, but it now works on Nix (Debian)

Re:Show HN: Simple PDF to PNG Server by marcus_holmes on Friday November 15, 2019 @12:15PM (#21546598)
what's your experience running soffice server-side? I might have to do this soon, and I'm dreading it.
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @12:18PM (#21546633)
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.

Re:Show HN: Simple PDF to PNG Server by marcus_holmes on Friday November 15, 2019 @12:22PM (#21546678)
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!

Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @12:28PM (#21546750)
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 by marcus_holmes on Friday November 15, 2019 @12:31PM (#21546787)
sent :)
Re:Show HN: Simple PDF to PNG Server by lixtra on Friday November 15, 2019 @05:08PM (#21549298)
We’ve been running it as part of alfresco. It’s not very stable and hangs every few weeks. Since we kill it every night we didn’t notice any problems.
Re:Show HN: Simple PDF to PNG Server by marcus_holmes on Saturday November 16, 2019 @08:42AM (#21552571)
good tip, thanks
Re:Show HN: Simple PDF to PNG Server by ztravis on Friday November 15, 2019 @02:20PM (#21547846)
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 by 7777fps on Friday November 15, 2019 @12:21PM (#21546667)
Does it support SVG?
Re:Show HN: Simple PDF to PNG Server by slowenough on Friday November 15, 2019 @12:25PM (#21546718)
as an output format?
Re:Show HN: Simple PDF to PNG Server by 7777fps on Monday November 18, 2019 @10:57AM (#21565292)
I wondered about input format.
Re:Show HN: Simple PDF to PNG Server by slowenough on Saturday November 23, 2019 @09:19AM (#21614211)
Hey, yeah I think it doesn't support fully on the input end, but it does support on the output (if you change the $format variable in the convert script).

Input looks a bit weird, for example,

https://secureview.cloudbrowser.xyz/uploads/file1tda.4paa65d...

Which is from:

https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/AJ_Dig...