How do I add an invisible text layer under a PDF for search?

As a user of the library I want to be able to open an existing PDF containing scanned images and add text to it generated through the Google Vision API. I do get coordinates and detected snippets of text. In order to improve the search-ability of the PDF I want to add the plain text to the PDF while the user shall not see the added text but the original scanned image. Though they should be able to copy "the scanned text" after the OCR.

UniPDF supports creating hidden text. This is useful for adding a layer of text on top of a scanned document (which is essentially an image), the hidden layer enables searching the PDF text and highlighting. This is done by creating styled paragraphs with text rendering mode invisible, see for example: