Code: Select all
\documentclass{article}
\usepackage{pdfcomment}
\begin{document}
yada yada
\pdfcomment{This is a PDF annotation -- works as expected.}
\pdfcomment{\input{some_text.txt}} % the PDF comment is literally the text “some_text.txt”
yada yada
\end{document}
Code: Select all
\documentclass{article}
\usepackage{pdfcomment}
\makeatletter
\gdef\pdfcommentfile#1{%
\begingroup
\everyeof{\noexpand}%
\long\edef\temp{\noexpand\pdfcomment{\@@input{#1}}}%
\temp
\endgroup
}%
\makeatother
\begin{document}
yada yada
\pdfcommentfile{some_text.txt}
\end{document}
(edit) Just discovered a limitation: If the source text contains \textLF, then it is seen as an undefined control sequence. So in input files need to filter through sed code:
Code: Select all
${/^$/d}
/^$/{N; s/\n/\\noexpand\\textLF /gi;}
s/%/\\%/gi
s/&/\\&/gi
s/_/\\textunderscore/gi