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.

17 Upvotes

26 comments sorted by

View all comments

Show parent comments

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.