I have a project where it would be very helpful to be able to include pdf pages with certain text and or number highlighted, and in addition limit the pages output to those which have the highlighted terms.
\documentclass[12pt,letterpaper]{scrartcl}
\usepackage {fontspec}
\usepackage{pdfpages}
{phrase to be searched,word,word2,word3,another phrase, 555-222-1212}
\begin{document}
\includepdf[pages=-,pagecommand={\thispagestyle{empty}},width=\textwidth]{First.pdf}
\includepdf[pages=-,pagecommand={\thispagestyle{empty}},width=\textwidth]{Second.pdf}
\includepdf[pages=-,pagecommand={\thispagestyle{empty}},width=\textwidth]{Third.pdf}
\end{document}
So that the output would be the combined contents of First.pdf, Second.pdf and Third.pdf, but only the pages with the terms "phrase to be searched,word,word2,word3,another phrase, 555-222-1212" included, and with those terms background highlighted.
The closest to this I have found is automated indexing against keyword file and I upon reading it found myself unsure how one would make a complete example. There could be both an ocr and a pdf-already-with-text solution to the question. I know this is a lot to ask, but I have been surprised here before with the things that are possible with TeX.
How to highlight keywords? might be relevant to the problem.
make soul highlight span lines describes how to use the soul package to highlight text.
Or add-comments-to-pdf-files-automagically-with-regular-expressions
Looks like pdfjam could extract pages from a pdf: quickly-extracting-individual-pages-from-a-document
As an alternative: Could this be done by extracting the text from the pdf files, and then re-assembling the document? (I realize that most/all formatting would be lost)
\write18
you could call it from your TeX file. Don't know about the highlighting.