Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: PNG to PDF Conversion in the Browser (to-pdf.net)
77 points by growt on March 10, 2022 | hide | past | favorite | 23 comments
Hi everyone, I build some "online" converters as a side project in the last weeks. The difference to existing conversion websites is, that my converters don't upload your files. Everything happens in your browser on your device (with the help of a lot of great Open Source Javascript libraries). I think privacy is an essential feature for a service like this, so my converters also don't use google analytics or any other form of tracking (in fact they use no external resources at all).

I started this because I ended up with some .heic files from my iPhone and had to use ImageMagick every time I wanted to upload them somewhere. So now there is https://heic.to-jpg.com and I can just drag and drop .heic-files there to convert them to jpg.

Next I needed to send some stuff to my accountant, so I made pictures, but he wanted a pdf. So I made https://png.to-pdf.net and I can drag and drop multiple png's and it will return a pdf with one image per page.

There are a lot of other converters that basically came free with the libraries I used, you can find them all in the sidebar (e.g. https://tiff.to-png.com).

I hope some of you will find this usefull.



For folks who need an offline tool, macOS has it in the right-click menu for most file formats under > Quick Actions.


Wow, today I learned, thank you. I honestly didn't know that. To my defense, I rarely use finder and forklift doesn't display Quick Actions. But had I known, I would probably not have made these converters, so it was probably alright.


Hmmm, that sounds like something I'd consider upgrading up from Mojave for.


You can checkout this too from Monterey, https://support.apple.com/en-in/guide/preview/prvw625a5b2c/m... very handy when dealing with screenshots & random pics with text that need to be extracted.


Finder.app and Preview.app are surprisingly decent format conversion tools


Hey, thanks making it. Easy to use and loads fast, perfect!

Talking about .heic, recently I learned that Shortcuts app from Apple in iPhone can do a various image operation, like resizing and converting between formats.

The one I used the most is resize to smaller size since .heic is gigantic. All I need to do is setup the shortcut once [1], then I can resize any photo I took from quick actions in gallery. Bonus, it also convert the image to .png for me.

If I remember correctly, Shortcuts also support converting image to PDF, so it's pretty powerful.

Because of it, I stopped using free website for converting stuffs and just do it on the phone. But I still like your website ;)

[1] I don't remember which article I read, but this one looks like a good starting point for setting up the shortcut - https://www.switchingtomac.com/tutorials/iphone/how-to-resiz...


> I hope some of you will find this usefull.

You're my new default converter! I really like that this is happening on the client. There were quite a few times where I "had to" use an online converter and did not feel comfortable. Most things today can be done client side, there's no reason that I have to upload my stuff.


Really neat! Thanks for these.

Can you tell me how to generally go about making these converters?

I've always wondered how all these file conversions (especially the image ones) are developed. Is it specific for one file type to another or is there some general method which can be used? How is this achieved in the browser itself?


Most of these go through a canvas element, which is something a browser can "draw on". For conversion from jpg to png for example you don't need any libraries at all because your webbrowser can read and write both of these formats: "draw" jpg on a canvas and read it as png, done. For others like heic and pdf I used open source JS libraries such as pdfJS.


Although that is an approach that can work, it's likely a very good way to either lose the colour space and meta data for an image, or to force it into sRGB. which is always a little disappointing if the source and destination support something better.


Great little tool, just curious why you would buy several domains to host these tiny single page tools?

to-pdf.net, to-png.com, to-jpg.com...

Does SEO really reward this more than simply using pathnames on a single domain?


Why would you want to convert a PNG to PDF? I don't understand the point.


As I wrote above, I build a bunch of converters. If PNG to PDF has no use for you, then maybe heic to jpg, or tiff to png, or webp to jpg? If you already have a quick and good solution for all of these (or you never need to convert in any of those ways), then that's fine too.


One example is that students often have to turn in files in PDF format but may not have a scanner for handwritten papers. It's not amazing quality, but this let's you take a photo with your phone and convert it to PDF for submission.


There are bespoke tools for scanning documents with your phone and exporting to PDF. The quality is MUCH better this way, as it automatically crops, aligns, and dewarps the image, plus applies filters to adjust the colours. You would have a hard time differentiating this from a proper scan.

(For example, Microsoft Lens: https://apps.apple.com/ca/app/microsoft-lens-pdf-scanner/id9...)


That's true. But in the situation with my accountant that led to me developing this, I already had a bunch of files on my computer. Some were screenshots of emails, some were photos, so this was a handy way to combine them all.


So you can make things like this: https://i.imgur.com/uq4a4PY.png


So... did you do PNG to PDF to PNG for that? :)


Why should it be A4 instead of the same dimensions as png?


Mostly because it's the common format for documents where I live. Also you can add multiple images with different dimensions and they will all be scaled to fit A4. But I will probably add different dimensions for other countries in the future.


Being tied to specific paper sizes is one of the biggest limitations of PDF. I run into this a lot when people try to distribute documents as PDF. There are a lot of assumptions built in when a PDF is generated.


Agreed, I think the PDF should be created at the same size of the original image. Or at least have an option to do so.


Thanks for this! Such a nice and simple tool!


[deleted]




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: