Live data from Hacker News

Show HN: PNG to PDF Conversion in the Browser

png.to-pdf.net

11–20 of 25 posts

Re: Show HN: PNG to PDF Conversion in the Browser

#11

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.

Re: Show HN: PNG to PDF Conversion in the Browser

#13
post #9

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.

Re: Show HN: PNG to PDF Conversion in the Browser

#15
post #7

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

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.

Re: Show HN: PNG to PDF Conversion in the Browser

#18

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

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.

Re: Show HN: PNG to PDF Conversion in the Browser

#19

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

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...)

Re: Show HN: PNG to PDF Conversion in the Browser

#20
post #19

Earlier quoted context omitted.

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.
Post reply on HN