Super simple solution.
tesseract
and the corresponding data package for your languageocrmypdf
either from AUR or pip.If your document is scanned/has no text layer, run it as
ocrmypdf input.pdf output_with_text.pdf
If it does have text, it doesn't always merge cleanly. You can use –force-ocr
but that rasterizes the file and makes it massive.