Akylas / OSS-DocumentScanner

Android document document scanning app
https://www.akylas.fr
MIT License
599 stars 22 forks source link

more exporting options(backup) #205

Open Bertklq1 opened 1 month ago

Bertklq1 commented 1 month ago

An option to inclued scanned documents to backup while exporting app's settings.

farfromrefug commented 1 month ago

@Bertklq1 good idea. it is something i want to do at one point.

DhruvaSambrani commented 1 month ago

As a stopgap solution, it would be nice to have a script that can build the pdfs from the exported data on a PC.

This is what I use, but it does not add OCR'd text to the file.

import os
import json
from PIL import Image

for l in os.listdir("Scans"):
    obj = json.load(open(os.path.join("Scans", l, "data.json")))
    print("Building", obj["name"])
    pages = []
    for im in obj["pagesOrder"]:
        pages.append(Image.open(os.path.join("Scans",l,im,"image.jpg")))
    pdfpath = os.path.join("Scans_pdf", obj["name"]+".pdf")
    pages[0].save(pdfpath, "PDF", resolution=100, save_all=True, append_images=pages[1:])
farfromrefug commented 1 month ago

@DhruvaSambrani Why do you need that? I mean if you use the app on android you can export PDFs from there? In the future i will add a way to sync documents PFDs to a folder on the phone (might be android only). Though all those devs take time. So not sure when

DhruvaSambrani commented 1 month ago

I am using the webdav backup more as a webdav sync option. The webdav also is synced to my laptop so that anytime i want to pull a specific document to share etc, its available on both my devices. However, the current webdav export only exports the images and metadata, not the pdf itself (I understand that you want to add it at a later time), so the easiest way currently is to run the script to build the pdfs on the laptop.

farfromrefug commented 1 month ago

@DhruvaSambrani i understand. Just know that some transformations are not directly applied on image (brightness, contrast, filters...) so your script also would not have it. Yes i intend to do it at one point. TBH it depends on the time/funding i get for that app. Right now it is pretty low and it is really hard to keep on working so much on this app while not bringing food to the table.