I have a PDF consisting of scanned images of pages from an old printed book. (It has not been OCRed, so is not searchable.) Using the Google Cloud Vision API, one can perform OCR, and what's more interesting, get the position of the (bounding box for) each word. Now, using TeX/LaTeX (with any engine), is there a way to add these words to the PDF at the corresponding positions, i.e. manually add an (invisible) OCR/text layer to the PDF such that it's still the scanned image that's visible but the text can be selected and copied?
(I realize that as we're not using any of LaTeX's structured-document features, nor any of TeX's typesetting features—breaking paragraphs into lines, doing kerning etc—and are manually positioning text that will not even be visible, it may seem that TeX is not really needed for this job. But I don't know any other tool either: there are tools like tesseract
that automatically do OCR and add the text, but I want control, to be able to choose what text goes where. There's probably a way to do it from within TeX/XeTeX/LuaTeX.)