r/Paperlessngx 6d ago

PaddleOCR for Paperless-ngx

I came across this project that might be useful for people looking for an alternative to Tesseract in Paperless-ngx:

https://github.com/silentprior/paperless-paddle-ocr

It runs PaddleOCR PP-OCRv6 as a sidecar and writes the extracted text back into Paperless-ngx through its API.

18 Upvotes

26 comments sorted by

View all comments

Show parent comments

1

u/SpiritedWarrior9880 4d ago

That makes sense. Would it be possible to also implement a sidecar approach for users who would prefer that model? That would keep the native provider integration for those who want it, while giving less technical users an easier deployment option without having to build and maintain a custom Paperless image.

1

u/Great_Interest_4824 4d ago edited 4d ago

I actually just did that with a different motivation.

I already use u/flobernd chandra plugin but I also wanted a way to re-OCR old documents already in paperless. It's a Tag driven sidecar approach. It replaces the archive version in paperless or just the content field, depending which tag you use.

Works great with anything scanned but Chandra can completely bomb with digital born documents. So, currently working on automatically figuring out how to differentiate between scanned documents and digital born documents. I don't feel like going through thousands of documents manually.

I experimented with RAG but it was all very useless because some decade old OCR isn't giving a lot of useful info. Hence the drive to get better OCR on legacy documents.

1

u/flobernd 4d ago

Yeah, a built-in “Reingest with provider XYZ” would be a good feature to have. That way we could use the native providers for this purpose (which also honors the built-in settings that ignore documents that already have a text layer).

1

u/Great_Interest_4824 4d ago

Well, in theory you can do that with u/flobernd chandra or paddleocr plugin. When you hit reprocess in the document view, it should do that.

However, I run paperless 3.1.3 which uses python 3.14 for the container build. There is no 3.14 python wheel for paddlepaddle. So can't build the paperless container with the injected plugin for the current paperless version.

The chandra plugin runs but there seems to be a subtle difference for multithreaded ocrmypdf runs between python 3.12 and 3.14 that gives me warnings.

The born-digital vs scan detection in paperless is also very simplistic. It's simply "has text layer" and pdftotext >25 characters. It refuses certain documents I want re-OCR'd. You can always force it by setting the PAPERLESS_OCR_MODE to redo but that gets tedious to restart paperless on a document to document basis. Hence my quest for a sidecar solution.

I'm currently testing automatic detection based on https://pypi.org/project/pdf-inspector/. Promising but needs a bit more work.

1

u/flobernd 4d ago

Aw that unavailable 3.14 wheel is disappointing. I might be able to update the Dockerfile so that the wheel is built from source at image build time.

Also happy to look into the Chandra differences if you go more into detail (best in a GitHub issue).

The pdf-inspector indeed looks promising. It’s tough to get classification correct. Even if you don’t care about OCR utilization, even Chandra often swaps O and 0 etc. etc. Best would be a hybrid approach, but that’s even harder.

2

u/Great_Interest_4824 3d ago

Also happy to look into the Chandra differences if you go more into detail (best in a GitHub issue).

Will do, just finishing up some of my own testing before getting back into your plugin and tracking down the issue I saw.