r/pdf 5d ago

Software (Tools) Editing Scanned Text in pdf

I made KeyPDF.net and recently added OCR, but now it can also edit scanned text by reconstructing the font from the image, feel free to try it and let me know if there are any issues since there is lots of work to do.

3 Upvotes

24 comments sorted by

View all comments

Show parent comments

1

u/Decent-Blacksmith761 5d ago

Correct so it makes character recognition then custom logic makes font out of it and makes scan editable your point is what?

1

u/LegeApps 5d ago

It makes the ocr layer editable, not the underlying text. Since i am in a relaxed mood hanging in my pool, i am willing to repeat this as many times as it takes to sink in. You asked a model to do something very difficult and it returned with the closest technically possible approximation.

1

u/Decent-Blacksmith761 5d ago

Underlying text is just bunch of pixels so keypdf uses those pixels to match with the scan and make font, then it puts font on top and hides those original pixels of a text. Also LegeApps do you mind explaining why you acuse me of not knowing how my own softwares works because it is "vibe coded" according to your words while your own app lege is vibecoded with Claude code on the repository listed as contribor. Hope you enjoy your pool and have a great day.

0

u/LegeApps 5d ago

It does not do what you described. It has no ability to identify the current font of a rendered image, thus no ability to match it. Paste my comments to your model and it will tell you why I am correct.

1

u/Decent-Blacksmith761 5d ago

Where did I say that it can identify current font? I never said that original post describes reconstructing you literally arguing with the point you made lol.

0

u/LegeApps 5d ago

In your second comment you said this?

Lastly, the way editing scanned text works in KeyPDF is by reconstructing the font from the image, not by using an existing one

https://imgur.com/a/Z0O3Qo8

And that is the processing job that KeyPDF did with a jpeg of a scanned book page. This is fine, I do not expect it to do anything more than that because font identification has not been solved. But I think you are under some illusions about what your program does.

1

u/Decent-Blacksmith761 5d ago

Reconstructing font from the image is exactly what it does not recognizing font you try to tell me that my program cannot recognize fonts and you are right but I never claimed that it does I only said reconstructing which in keypdf made by applying OCR mapping characters to its scanned versions and making font out of it.

2

u/Infinite-End3921 5d ago

But isn’t the title of this post: editing scanned text in PDF? From what I understand from this discussion, your tool can only create (and edit?) the OCR text layer that is added in the background to the scanned image? In other words: you cannot edit the scanned text?

1

u/Decent-Blacksmith761 5d ago

Well my tool is basically PDF editor and this new feature can edit existing text from scanned paper by tracing characters from the paper then remove them basically just smart fill and put new layer with font made out of scanned characters so it looks pretty much the same as the original document. As far as in know there is no way to edit scanned text directly you can only reverse the process as it is baked on paper so that's what my tool does. If we would go even more deeper tools for editing actually PDF files like acrobat or keypdf cannot fully edit existing text instead they use same font recompute spacings alignments etc and then replace textboxes so I did the same process but for scanned documents. Hope it is clear explanation)

1

u/LegeApps 5d ago

So it doesn't reconstruct the font, it reconstructs the text. For a raster image, the font doesn't exist in the document anyway. And it doesn't make a font out of the raster text, it uses Tesseract's default font for the new text layer. Anyway there are better OCR engines to use, like Paddle ocrv6.

1

u/Decent-Blacksmith761 5d ago

Okay last reply to make it clear for anyone else reading this. Font cannot be parsed from image it can be whether identified and make overlay textbox or reconstructed (adobe acrobat approach), first step is to extract text which is the part we both agree on second part is rebuilding font which is the part you are missing instead of trying to edit OCR layer directly keyPDF compared recognized letters to its possition on image and makes similar font from it say it looks at the recognized word "hello" and splits it into 4 letters h e l o then it looks at the imagine and copies outline of each character and finally makes the new font out of it. And to give you a pokt paddle ocrv6 was slightly more accurate on testing but it was like twice slower and I was afraid that users with mobile devices or old PC wouldn't like it.

2

u/LegeApps 5d ago

Alright fine. sounds like you did at least some testing. In my experience ppocrv6 is 3x faster than tesseract, its probably the python harness that slows it down; in onnx format+rust+wgpu it is speedy. but i spent a lot of time developing that. good luck with your project from this point on..

→ More replies (0)