Hacker News new | ask | show | jobs
by IvanK_net 2275 days ago
I spent about three years building the support for PDF into my graphics editor https://www.Photopea.com .

While other editors "add stuff on top of PDF", Photopea "chews through" each byte of a PDF, and tries to make as much sense of it as possible.

You can rewrite the existing text (with the same formatting), edit bézier curves, edit gradient fills. You can edit bitmaps on a pixel level. You can see the parameters as CSS or export it into an SVG.

Also, it is free. People open about 150,000 PDF files a month in it, but I hope it will get more popular in the future.

Demo PDF: https://www.photopea.com/api/img2/WEBSITE-ZLONIN-uprava.pdf

Photopea: https://www.photopea.com#%7B%22files%22:%5B%22https://www.ph... (press T and click into the text to edit it)

17 comments

Wow that's insane. It never would have even occurred to me to use Photopea for editing PDF's.

But it does indeed import each element of the PDF as a separate layer, and you have PDF export with options to leave text as-is, rasterize text, or vectorize it.

Two questions:

1) Does it set the resolution of the Photopea file, and the default resolution to re-export the PDF, to trying to detect the original resolution of images in the PDF? So that by importing and exporting, you're going to have a PDF of approximately the same quality and filesize?

2) Are you able to handle embedded fonts, including subsetted fonts? I assume that in that case you would vectorize it and wouldn't be able to type new characters... just want to know if I'm wrong in assuming that?

Thanks again a million times over for Photopea. It remains my absolute #1 inspiration of what one developer on their own can do. Never ceases to amaze. :)

1) In a PDF file, the measure units are Inches. The page size is in inches. Any dimension is in Inches. There can be a bitmap having 200x200 pixels placed at 3x3 inches. Next to it can be a bitmap of 5x5 pixels placed at 5x5 inches.

That means, that PDF does not contain any DPI information. It is not needed at all. PDF rasterizer (e.g. a raster printer) can render it at any DPI. Photopea decodes and saves back bitmaps inside PDF in the original resolution. The rest is vector graphics.

2) For now, Photopea ignores embedded fonts. But it extracts the font name and in 98 % of cases, we already have the required font in our database of fonts, so we can render it identically.

Don't you mean points, not inches?

That's why page dimensions are things like "/CropBox [0.0 0.0 595.27576 841.89001]". PDF points are the same as Postscript points, 1/72 of an inch, that is 25.4/72 mm. So those numbers mean a page 210mm wide and 297mm high: A4.

Yes, the actual values are points, and one point is 1/72 of an inch, which is the same, as if the values were in inches. I just wanted to point out, that the units are physical (unlike "logical" units in an SVG or in a webpage).
I absolutely love Photopea. Thank you for making it. It's my number 1 go to Photoshop alternative.

Any chance you will package it for desktop? It would be great for Linux.

As a random user my thought is that as a PWA it's already desktop worthy in any environment, but I must agree that the average user does not know what a PWA is and how to use it.

Perhaps packaging it with electron could be an option, but it's an additional burden (I know by experience) that I'm not so sure is worth it.

Wow. I've just done a couple of things that are very hard or next to impossible with Acrobat DC in Photopea without so much as hitch. Amazing Work!
I had no idea. This is revelation. I am thinking that if more people knew about these features you would have 10 times that a month!
Photopea is a masterpiece. Thank you for building this thing.
Wow. Sounds like you seriously need a separate landing page marketing Photopea as an advanved pdf editor.
It is written right when you open Photopea.com :D https://i.imgur.com/zgX380J.png
It mades me laughed.
Wow nice. I was just about to cancel my Photoshop subscription because 1) I hate subscription pricing models and 2) I'm using it mostly just to resize images.

Nice to see that you have the Photoshop UI there so I don't have to relearn anything.

I understand a professional not wanting to learn a new UI for something as complex as graphics editing, but if you are admittedly mostly using it to resize images, I can't imagine why any other tool, including the infamous Gimp, would be so hard to "learn"?
I think I was overstating the extent to which I only use it for resizing photos.
Why not use Preview? For most things, like resizing and cropping, and rotating, it just works
It doesn't do compression or format conversions.
It does do some format conversion and have some support for compression settings (if I understand you correctly). Under the File -> Export menu you can choose between some formats [0] and when applicable choose compression level, e.g for JPEG.

[0]: On my machine: HEIC, JPEG, JPEG-2000, OpenEXR, PDF, PNG, TIFF

Dude, this is incredibly awesome! I've never heard of it even though this is something I've been looking for for a long time. I bet your software can get extremely popular if you can market it better.

I've immediately posted it on HN (hopefully I won't be downvoted just for linking my own post).

https://news.ycombinator.com/item?id=22791151

Just wanted to say thank you for Photopea. It is brilliant!
This is actually great! For many (but not all) files works much better than pdf editing in Inkscape which I was using up to today.

Two suggestions: 1. Make it clear to users why install button is greyed out. I know it, but most won't. 2. Allow login with any oauth provider, not everyone likes to be tracked across the web

Awesome feature!

Is there a way to change resolution during editing? When I zoom in in Photopea, I can see individual pixels of text characters. With some PDFs pixels show up sooner, making text barely readable during editing.

The preview in Photopea is always rasterized (pixelated at a certain zoom). But you can increase the resolution in Image - Image Size.
I literally needed this just a few hrs ago and instead had to resort to a free trial of adobe reader pro (ugh). I’ll check this out for next time, looks great.
Woah! Thanks for your amazing work. It never occurred to me either to use photopea for this and I use photopea for all kinds of other tasks.
Just amazes me how much PhotoPea does and it is built by one person and work without intrusive ads. Great work and you are an inspiration.
Photopea is an incredible piece of software. Really thanks for it.
sorry for my dumb question, but i was looking to add a simple arrow. Can't find it. Where is it hiding? :) Thx
You can find a picture of an arrow online and copy-paste it into your document :) or you can draw your arrow with a Brush tool, or with a Pen tool, etc :)
dude.... this is insane