OSS-DocumentScanner icon indicating copy to clipboard operation
OSS-DocumentScanner copied to clipboard

[FEATURE REQUEST] Workflow for automatic OCR, PDF Export, sync and delete

Open supaeasy opened this issue 1 year ago • 16 comments

Is your feature request related to a problem? Please describe. No, it is a feature request to use it as the scanner and OCR App for paperless-ngx and alike

Describe the solution you'd like I would love to be able to define a fixed workflow/profile to start automatically after a picture has been taken:

  • improve Image (possible already)
  • white paper (possible already)
  • perform OCR
  • Export PDF
  • Sync PDF to WebDAV folder (better: send it there directly)
  • delete local scan after 5 minutes (or immediately after confirmation sync to WebDAV has been successfull)

Describe alternatives you've considered Right now I have to do all steps after white paper manually. I use this app to send a PDF to my consume folder of Paperless-ngx

Additional context If this whole this is too complicated please at least two things: I dont really get the point of "syncing" with WebDAV-Folder. The file is not deleted after it is synced and when I sync it again, I get a duplicate in my consume folder. And: Auto-OCR. I keep forgetting it and Paperless OCR is crap.

supaeasy avatar Nov 30 '24 23:11 supaeasy

@supaeasy the WebDAV sync (PDF /images) can be used for people not using paperless. Or people.using paperless where a folder on the WebDAV server would be read by paperless.

So in your request only the auto OCR / delete is not possible right now. PDF auto generate sync already exist.

About the delete not sure I want to.add this. Too dangerous people would.complain they document werr deleted . what you could easily do for now is add those doc in a folder. And regularly simply select that folder and do delete (one op). As for the auto OCR I will look at it. But remember this won't be fast. Maybe I could add it as an option of the PDF sync that way it would be done in thé background. Would that be good for you?

farfromrefug avatar Dec 01 '24 17:12 farfromrefug

Thanks for your reply. Yes, this is kind of what I want to do. But would this also auto export the PDF? I would need:

  • Trigger: Picture taken and Image enhancements applied
  • Automation: OCR, Export PDF, Sync PDF
  • Ideally: some confirmation / event / message when Sync is complete that I can use as a trigger for macro droid so it can empty the export folder.

supaeasy avatar Dec 02 '24 00:12 supaeasy

Thanks for your reply. Yes, this is kind of what I want to do. But would this also auto export the PDF? I would need:

* Trigger: Picture taken and Image enhancements applied

* Automation: OCR, Export PDF, Sync PDF

* Ideally: some confirmation / event / message when Sync is complete that I can use as a trigger for macro droid so it can empty the export folder.

Yes if you setup PDF sync (either webdav or local folder) it should trigger as soon as you create a new (or update) doc

As for the confirmation, right now the UX is redrawn on sync success but now confirmation/event/message. I could add a broadcast if you want to notify of sync change

farfromrefug avatar Dec 02 '24 15:12 farfromrefug

That would be great, thank you. On another note: It was totally unclear to me, that a PDF is created automatically, wether you press export or not - what is the export button for then?

supaeasy avatar Dec 03 '24 00:12 supaeasy

@supaeasy it is released https://github.com/Akylas/OSS-DocumentScanner/releases/tag/com.akylas.documentscanner%2Fandroid%2Fgithub%2F1.13.0%2F106.

Now about your export question. No a PDF is created automatically when you "show" the pdf menu. It is created only when using each of the commands (share, export,...) The difference is that with export it is created where you want, while for other options it is created in a temp folder so that it gets removed

farfromrefug avatar Dec 05 '24 10:12 farfromrefug

Thank you very much, that was way quicker than I expected! But may I ask where that option is to be found? Or is Auto-OCR now just the default?

supaeasy avatar Dec 09 '24 21:12 supaeasy

@supaeasy you can enable it within your sync configuration settings. Go into sync settings -> PDF sync. Click on your sync config. Their you can enable it

farfromrefug avatar Dec 09 '24 22:12 farfromrefug

Great, I found it. Thank you! Did you also implement the "broadcast" you mentioned when a sync event ended successfully? (Actually I don't know what that means but I assume this is some kind of event that I can pick up with MacroDroid for a deletion trigger as discussed, yes?) My favored way still would be a built-in delete option after sync, I think that would be cleaner. That option would Ideally fit into the same place as the new OCR option because one could define it on a sync event base - wouldn't that leave your worries behind? You said people would likely complain about deleted documents - I think an opt-in option that far into the sync settings would assure this is only used by people like me who really want this to happen.

Maybe to elaborate why I am kind of pushy about this: I sync directly to a so called "consume" folder for Paperless. This is a constantly monitored watchfolder and every document in there will be deleted after it has been processed by Paperless. So your App will see an empty folder after a couple of seconds and will re-sync all documents. This process creates neverending duplicates after duplicates and is especially annoying when using auto-sync. Do you understand why this is a major pain point to me? :-)

supaeasy avatar Dec 09 '24 22:12 supaeasy

@supaeasy what actually do you want to delete? Do you want to delete the document from OSS Document scanner app? Or is it deleting files in the local folder?

farfromrefug avatar Dec 11 '24 10:12 farfromrefug

Well, both actually. I just want to transfer a scan to my WebDAV folder and delete it from my cellphone afterwards.

supaeasy avatar Dec 11 '24 10:12 supaeasy

@supaeasy ok :

  • delete doc in the app: possible though tricky because there could be multiple sync running and if i delete the doc too soon it will break the app
  • delete the file create in the local folder. That i cant, has to be done by paperless (i dont know when it finished processing it)

farfromrefug avatar Dec 11 '24 10:12 farfromrefug

Oh, I misunderstood you: as in 'local folder' on the phone. Deletion from my synced folder is done automatically by paperless. To me that would be the remote folder.

Deletion in App: does the app not get a feedback when syncing is done?

supaeasy avatar Dec 11 '24 10:12 supaeasy

Oh, I misunderstood you: as in 'local folder' on the phone. Deletion from my synced folder is done automatically by paperless. To me that would be the remote folder.

Deletion in App: does the app not get a feedback when syncing is done?

Yes it does but syncing happens in a background thread in a parallel way. So the sync for which you want deletion might have finished while others are still running. And i would need to handle the deletion on a per sync basis. It is tricky. Not saying it is not feasible, just saying have to be done right and for now not easily done. As i mentioned before i think the cleanest and easiest way right now is to do it in a folder, and then once in a while you delete all documents from that folder from the app

farfromrefug avatar Dec 11 '24 11:12 farfromrefug

Hey I find @supaeasy idea very appeasing. I used ScanBot for a decade or so (also the predecessor). And I set up exactly that workflow. Like this: MANUAL: scan -> crop -> check scan manually/adjust scan -> hit save -> edit (predefined) file name, than starts the AUTO Workflow: OCR -> file is saved (Scanbot: gdrive / OSSDS: Nextcloud folder) -> deletion of local file -> pop up message "File successfully transferred/synced"

I like it when the phone local file is deleted after it is synced/transferred. I know myself, after a while the phone will be very cluttered. Therefore I like the auto deletion feature as mention as an opt-in solution, for people like @supaeasy and me.

I don´t get the sync feature, because I am using Nextcloud I can just save the file via export to the "local" Nextcloud folder. The sync means in my understanding, if I am moving/deleting the file in the Nextcloud folder (which acts as an "inbox" for me, I do manual sorting of file; paperless will be a thing for the future!) then the sync from OSSDS might transfer the file again to my Nextcloud? Or is a two-way sycn?

Thank you for your great work @farfromrefug and fast responses. OSSDS is a nice tool and very close to my old workflow from ScanBot (on iOS).

EIDT: I checked it out. It is not a 2-way-sync. Therefore I have to manually delete the files on the phone after I moved them from my "inbox" folder on Nextcloud (or paperless "consume" folder). Then the whole autoPDF with OCR Sync does not make sense for me. In general that would mean having two places where the scanned files are stored, which are synced like phone -> WebDAV/SyncFolder. I prefer having a file only in place safed (like my Nextcloud Instance) and have general backup for that one place in case of data loss.

Another thing: Is it possible the replace the "" (underline) with a blank space " " at the autonaming feature? Now the file name is with "" instead of " " as I placed them in the "file name" in the OSSDS app.

drp4positive avatar Apr 04 '25 16:04 drp4positive

@drp4positive about the sync feature. Data sync is 2 ways yes. Is when you work with multiple phones / tablets. I use that because in don't store my documents as PDFs. I store them only in ossds so that I can easily export with different settings

PDF/ image sync is one way so if you delete the document after sync it will remain deleted.

I will see about auto delete but not before September . I am on a 6 months trip

Can you open another issue about the file.naming ? Thanks

farfromrefug avatar Apr 20 '25 10:04 farfromrefug

Done. And thanks for all your work.

drp4positive avatar Apr 22 '25 20:04 drp4positive