
Show HN: Simple PDF to PNG Server - slowenough
https://secureview.cloudbrowser.xyz/secretpage-canneverbefound.html
======
slowenough
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...](https://secureview.cloudbrowser.xyz/uploads/filekat9.v05lnle.pdf.html)

[0]: [https://www.tesla.com/sites/default/files/tesla-
model-s.pdf](https://www.tesla.com/sites/default/files/tesla-model-s.pdf)

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

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

~~~
marcus_holmes
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!

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

~~~
marcus_holmes
sent :)

------
jermaustin1
Before I upload and download a file from a random Show HN with URLs like
"secretpage-canneverbefound" and "very-secure-manifest-convert", I'd like to
see some source code.

Typically with little projects like this it is customary to discuss how you
built the application.

~~~
slowenough
It looks like the URLs named like that are trying to hack you and steal your
secrets, I get that.

The reason they're named that way is an artifact of how this was meant to be a
private service to let a remote cloud browser view PDF (etc) files securely,
without forcing the client to download them.

So initially I didn't intend to make this public as its own service because
the service was supposed to have only 1 customer (this other service).

It wasn't easy at first, as ImageMagick took a long time to convert PDFs at
300 dpi, so I rebuilt it with multicore support, and still it took a long
time. I eventually discovered a sweet spot at 100dpi.

But aside from that I tried to keep it very simple, it's just some Node.JS and
some shell scripts running on FreeBSD on digital ocean.

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

~~~
slowenough
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 (PDFium
recently caused a Chrome 0 day I think).

~~~
devxpy
Wow, wasn't expecting such a well constructed counter argument.

~~~
slowenough
Thank you. The internet, eh? You never know what you're gonna get.

------
4ver
Does this use ghostscript? Was looking into doing this a while back but wasn't
sure if I'd have to get a license from Artifex to use it in a SaaS app.

~~~
slowenough
The `gs` I have installed says it is licensed with this[0][1] so I think it's
fine.

[0]:
[https://www.gnu.org/licenses/agpl-3.0.en.html](https://www.gnu.org/licenses/agpl-3.0.en.html)

[1]: [https://tldrlegal.com/license/gnu-affero-general-public-
lice...](https://tldrlegal.com/license/gnu-affero-general-public-
license-v3-\(agpl-3.0\))

------
bluetidepro
Yeah, let's just upload our files to a page that's called "secretpage-
canneverbefound.html", and with no info other than the 5 word title on HN. -_-

~~~
thatguyagain
I mean you don't need to upload a PDF list of all your darkest secrets.

~~~
mobilemidget
No but a mention this is happening serverside and you are actually copying the
file to the server kind of notice or message would be correct imho

~~~
behindsight
> [...] mention this is happening serverside

Not being snarky, but the submission title does say "Server".

~~~
mobilemidget
I know, and you, and probably all tech savvy people, realise when clicking the
browse file button you are probably going to submit a file to a server, but
not everybody does and those do need an explicit warning in my opinion.

------
bluedino
Do this with plot files and dxf's and you can sell it

~~~
slowenough
If you'd like to mail me at cris@dosycorp we could discuss what you need.

------
alpb
Have you considered making this open source and distribute as a container
image that people can self-build/deploy/host on a serverless platform, like a
Google Cloud Run?

For example, this DOC to PDF converter: [https://github.com/as-a-
service/pdf](https://github.com/as-a-service/pdf)

~~~
slowenough
Thanks, this is actually on FreeBSD, so it's not so easy to make it for
Docker, but the repo now has a Dockerfile for nix systems. I haven't tested it
tho.

------
fahrixds
[https://www.tesla.com/sites/default/files/tesla-
model-s.pdf](https://www.tesla.com/sites/default/files/tesla-model-s.pdf)

------
andrewstuart
I like the minimalism.

