在pdf文件的第一页上添加文本 [英] add text on 1st page of a pdf file
问题描述
我正在尝试将文本注释(而不是注释)添加到pdf文件中. 我创建一个包含文本注释的date.ps文件: %! /Arial findfont 30 scalefont setfont 新路径 10720移至 (2013年5月1日的付款)显示 显示页面
I'm tryin to add a text comment (not a note) to a pdf file. I create a date.ps file with contains the text comment : %! /Arial findfont 30 scalefont setfont newpath 10 720 moveto (PAID on 5.1.2013) show showpage
然后我用$ i =要标记的pdf文件的名称启动shell命令: gs -q -dNOPAUSE -dSAFER -dBATCH -sOutputFile = $ RFP/$ DOMAINE/$ NEWNAME -sDEVICE = pdfwrite -sPAPERSIZE = a4 date.ps $ i
and I launch the shell command with $i=name of the pdf file to tag: gs -q -dNOPAUSE -dSAFER -dBATCH -sOutputFile=$RFP/$DOMAINE/$NEWNAME -sDEVICE=pdfwrite -sPAPERSIZE=a4 date.ps $i
这可行,但是它会单独创建一个新的第一页,其中仅显示文本"PAID on 5.1.2013".
This works, but it create a new 1st page empty with the text "PAID on 5.1.2013" alone.
我找不到在原始pdf的第一页上覆盖文本的技巧.
I do not find the trick to overlay the text on the 1st page of the original pdf.
你能帮我吗
推荐答案
由于您的PostScript执行了显示页面,因此它会在标记后弹出第一页,因此其余内容位于第二页和后续页面上.如果不执行显示页面,则您所做的标记将显示在首页上,而第一个PDF页面将被绘制在其顶部.
Because your PostScript executed a showpage it ejects the first page after marking it, so the remaining content is therefore on the 2nd and subsequent pages. If you don;t execute showpage then the marks you make will be on the first page, and the first PDF page will be drawn 'on top' of it.
更复杂的代码可以使用BeginPage和EndPage在页面内容的上方和下方进行绘制,以及在指定页面上进行绘制.
More complex code can use BeginPage and EndPage to draw over and under the page contents, and to do so on specified pages, among other things.
[稍后添加]
尝试一下:
%!
<<
/EndPage
{
0 eq
{
0 eq
{
/Arialabold findfont 22 scalefont setfont newpath 250 820 moveto 1 0 0 setrgbcolor (PAYE PAR CCP LE $DATEPMT) show
} if
true
}
{
pop false
} ifelse
} >> setpagedevice
为我工作.
这篇关于在pdf文件的第一页上添加文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!