答案1
以下过程依赖于 2 个包并使用 来\pdffilemoddate{<file.ext>}
从 中提取文件修改日期<file.ext>
。原始下载文件包含在使用pdfpages
。并且,对于所包含的下载文件的每个页面,我们执行pagecommand
插入包含文件修改日期(应与下载日期相对应)的水印。水印插入到每个页面的顶部,F
使用G
eso-pic
的\AddToShipoutPictureFG*
。
\documentclass{article}
\usepackage{eso-pic,pdfpages,lipsum}
% https://tex.stackexchange.com/a/12310/5764
\newcommand*{\filedate}[1]{%
\expandafter\filedateX\pdffilemoddate{#1}\relax
}
\def\filedateX#1#2#3#4#5#6#7#8{%
\filedateXX{#3#4#5#6}{#7#8}%
}
\def\filedateXX#1#2#3#4#5#6#7#8{%
\filedateXXX{#1}{#2}{#3#4}{#5#6}{#7#8}%
}
\def\filedateXXX#1#2#3#4#5#6#7#8\relax{%
\formatdate{#1}{#2}{#3}{#4}{#5}{#6#7}%
}
\newcommand*{\formatdate}[6]{%
#1-#2-#3\ #4:#5:#6%
}
\begin{document}
\lipsum[1]% Text before the included/downloaded file (if it exists/is needed)
\includepdf[
pages=1-2,
pagecommand={
\thispagestyle{empty}% Remove header/footer
\AddToShipoutPictureFG*{%
\AtPageLowerLeft{%
\hspace{2em}% Move watermark into page
\rotatebox{90}{%
\makebox[\paperheight]{\Large Downloaded on \filedate{lipsum.pdf}}%
}%
}%
}%
}
]{lipsum}% Include downloaded file
\lipsum[2]% Text after the included/downloaded file (if it exists/is needed)
\end{document}
将输出转换\pdffilemoddate
为更易读的内容得益于文件创建日期。