> Converts an image to a single-page PDF with a hidden text layer using Tesseract. This is the 'State Preservation' step.
Does this mean the text only pdf page is transformed into an image that covers the full page, but the text is still under there. So, any machine based extraction would still get the text, but would probably loose all the bounding box information and regular users cannot just use their mouse to select text anymore?
kumarm 10 days ago [-]
Seems true and really wish the project included some sample PDF output.
My Text to Speech app uses bounding box to display what text in PDF is being read and would not work well PDF's from this project.
GavCo 10 days ago [-]
OP here, I added a sample PDF output in the project assets and put screenshots in the ReadMe. The text is selectable after rehydration. would this work with your app?
kumarm 10 days ago [-]
Amazing. Worked really well. Thank you.
tecoholic 10 days ago [-]
Wait! what? This is incredible. Amazing work.
lxe 11 days ago [-]
This is nuts and I absolutely love this. So you convert the PDF into image, edit the image, then convert the image back into a PDF.
thenthenthen 10 days ago [-]
This is the usual workflow dealing with pdfs (unfortunately)
esafak 9 days ago [-]
No, it's not, unless you are dealing with scans. Lots of apps let you edit PDFs.
shevis 10 days ago [-]
A side effect of replacing entire pages with images is that the file size will expand dramatically. Most PDFs only contain a couple of images
falcor84 10 days ago [-]
It might be feasible to have an intermediate AI call take the generated image and slice it into individual text and image elements that it would then render into the pdf page
moezd 10 days ago [-]
Behold, the might of LLMs! Instead of ushering the age of AGI as advertised 6 months ago, now it cleans your PDFs for you.
Many thanks to humanity for failing to standardise PDF and this project for paying interest on that tech debt with datacenter levels of energy consumption.
struc_so 8 days ago [-]
Interesting approach. I've spent a lot of time wrangling PDF internals recently, and the issue is usually maintaining the xref table integrity when you inject new content streams.
Does this approach rewrite the entire file structure on save, or are you appending incremental updates to the EOF? Incremental is safer for corruption, but file size bloats quickly with AI-generated diffs.
treetalker 11 days ago [-]
I'd love to see clearer examples: a video, or original pdf / command / result pdf. Very cool!
jimmySixDOF 3 days ago [-]
Is Tesseract still considered the go to here for OCR I would have thought lot of other options are out there now
perfectritone 10 days ago [-]
It's incredible how many hacks there are to make PDFs semi-usable.
itsmevictor 11 days ago [-]
Very nice! I wonder whether that could be used to get LLMs to annotate pdfs. Say an "agentic" CLI like Claude Code or Gemini-cli reviews a pdf and finds typos, could it use this to annotate the pdf like underlining them in red or something of that sort? That could be nice.
Please don't add an animated gif to your README. Nothing worse than an autoplaying video with no controls, that has 10 frames but takes 5.4MB to download. Github supports normal video files. It allows the user to rewind or pause, and it results in a much smaller file size.
varenc 10 days ago [-]
Generally agreed! though fun point of info: you can use the .avif format to get something that behaves just like a gif (auto-playing, no sound, no controls) but supports modern features (HDR/transparency channel) and is compressed as well as a modern video is, since its just AV1. And it's supported in most all modern browsers these days: https://caniuse.com/?search=avif
ornornor 10 days ago [-]
I tend to use webm but I’m curious, is avif better (performance, size) for gif?
varenc 10 days ago [-]
Webm is better in many ways, but it doesn't give you gif-like behavior I think. As in, you can't just include it in an <img> tag and a get an autoplaying looping video. Though you can simulate it with <video>.
Basically, .avif is an "animated image" format, like .gif, but .webm is only a video format.
edit: just realized .webp i think can be an animated image! So that seems like the alternative
ornornor 10 days ago [-]
Thanks
iamflimflam1 10 days ago [-]
The lack of examples makes me very reluctant to commit any time to trying this out - despite it being something that I’m interested in.
Has anyone given any it a go? Does it work?
stingraycharles 10 days ago [-]
What? There are examples in the repo and even in OP’s post.
I haven’t tried it, but there are plenty of examples.
albert_e 10 days ago [-]
Do you mean example commands? we see those examples on the githib README, yes,
But people here are probably also looking for example input and output PDFs (or images/screenshots) showing the actual work done to get a sense of what to expect.
iamflimflam1 10 days ago [-]
Exactly - if these examples work really well, then include some screenshots.
ThrowawayTestr 11 days ago [-]
I recently tried to change a single word in a PDF and nearly tore my hair out (thank you LibreOffice) I'll definitely keep this in mind for next time, thank you.
tkfoss 10 days ago [-]
Try photopea next time
albert_e 10 days ago [-]
Wow - didnt know about this tool for PDF editing - thanks!
PS: in my quick test of editing a PDF text -- the output PDF had weirdly added an extra "&" symbol at the end of every existing line of text. will try out more to see if it was something in the input PDF that was causing it.
fzysingularity 10 days ago [-]
What is photopea built on?
tkfoss 8 days ago [-]
Author does yearly AMAs on reddit, you should look it up.
McNulty2 10 days ago [-]
I like the example of updating latest market data. Updating a deck one-off is tedious. Keeping it updated long-term was never going to happen. But now it can
toddmorey 10 days ago [-]
I thought it was kinda funny that Google Slide’s own built in “beautify this slide” button converts the whole slide into an uneditable image.
albert_e 10 days ago [-]
AFAIK -- even the "Designer" feature of Microsoft Powerpoint (now folded under Copilot license I believe) gives slide deigns with shapes etc that are not editable. Thankfully the text remains editable. But if we wnat to ever so slightly modify the suggested design my removing or reshaping some if the shapes ... nopes. Feels like they are worried about humans with taste ripping-off the AI output :D
mlpoknbji 10 days ago [-]
Somewhat unrelated but can anyone recommend a way to edit the text of a PDF using LLM? Something like AI + acrobat pro?
ohans 8 days ago [-]
Really cool! I reckon a nice UI would be a good addition
informal007 10 days ago [-]
it will be more excited if i can use this feature in application with GUI, it’s now convenient to check the result after edit the PDF, i need to transfer between CLI and PDF reader
vood 10 days ago [-]
Congratulations on the release; that's a really good job.
John7878781 10 days ago [-]
Love this.
After several iterations of edits, would the image quality decrease?
Zopieux 10 days ago [-]
I am disappointed that this doesn't modify the underlying pdf structure (which is a horror show, I know) but instead relies on fairly lossy OCR back&fourths.
I wish an agent with a validation and rendering tools could instead manipulate the structure to accomplish those edits way less destructively, checking its progress with the tools.
mertleee 10 days ago [-]
[dead]
sultson 11 days ago [-]
[dead]
Rendered at 09:58:54 GMT+0000 (Coordinated Universal Time) with Vercel.
Does this mean the text only pdf page is transformed into an image that covers the full page, but the text is still under there. So, any machine based extraction would still get the text, but would probably loose all the bounding box information and regular users cannot just use their mouse to select text anymore?
My Text to Speech app uses bounding box to display what text in PDF is being read and would not work well PDF's from this project.
Many thanks to humanity for failing to standardise PDF and this project for paying interest on that tech debt with datacenter levels of energy consumption.
Does this approach rewrite the entire file structure on save, or are you appending incremental updates to the EOF? Incremental is safer for corruption, but file size bloats quickly with AI-generated diffs.
Basically, .avif is an "animated image" format, like .gif, but .webm is only a video format.
edit: just realized .webp i think can be an animated image! So that seems like the alternative
Has anyone given any it a go? Does it work?
I haven’t tried it, but there are plenty of examples.
But people here are probably also looking for example input and output PDFs (or images/screenshots) showing the actual work done to get a sense of what to expect.
https://www.photopea.com/
PS: in my quick test of editing a PDF text -- the output PDF had weirdly added an extra "&" symbol at the end of every existing line of text. will try out more to see if it was something in the input PDF that was causing it.
After several iterations of edits, would the image quality decrease?
I wish an agent with a validation and rendering tools could instead manipulate the structure to accomplish those edits way less destructively, checking its progress with the tools.