# How to substitute some text in a existing PDF file while using includepdf

I have a existing PDF, and it is included into my document through \includepdf in package pdfpages, and I'm curious that can some text in the PDF file be substituted by some else?

For example, I have foo.pdf with contents

foo foo1 foo2


and it's included in bar.tex

\usepackage{pdfpages}
\begin{document}
\includepdf{foo.pdf}
\end{document}


Can I add some directives in bar.tex, substituting foo1 in foo.pdf with bar1, making bar.pdf like this

foo bar1 foo2


As I know, package PSfrag can edit text in EPS file.

-
I don't believe it's possible. You'll need a tool like qpdf. –  Stephan Lehmke Jan 6 '13 at 12:30
@Stephan thank you, I'll check that. –  Haocheng Jan 6 '13 at 16:05
pdfTeX, etc., cannot edit the content of PDFs: they only copy material from the source PDF files into the output PDF. As such, if you want to do more complex modifications you will need to use a third-part tool such as qpdf.
How about pdftk? Can it be used for this question? –  please stop stalking Sep 8 '13 at 9:22
@PSTikZ No, not in this case. The question seems to be about editing the text of a PDF, which pdftk can't do. If it's just a question of picking specific pages then you don't even need an external tool. –  Joseph Wright Sep 8 '13 at 9:34