Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stamp (not watermark) PDF file

Status
Not open for further replies.

lukinbg

Technical User
May 15, 2013
1
This script "watermark.ps" creates a watermark (=text in background) on each PDF page:

'<<
/BeginPage
{ gsave
/Helvetica_Bold findfont 72 scalefont setfont
.75 setgray 130 70 moveto 50 rotate Watermark show
grestore
} bind
>> setpagedevice

gs -q -dNOPAUSE -dSAFER -dBATCH -sOutputFile=output.pdf -sDEVICE=pdfwrite watermark.ps -f myfile.pdf

Any idea how to rewrite it to create a stamp (=text in foreground) on each PDF page?

 
Hi,

I dont know if it's late, but you could use /EndPage instead of /BeginPage to achieve that.

Something like this:

Code:
/watermarkText { (WATERMARK TEXT) } def
/watermarkFont { /Helvetica-Bold 72 selectfont } def
/watermarkColor { .75 setgray } def
/watermarkAngle { 45 } def

/pageWidth { currentpagedevice /PageSize get 0 get } def
/pageHeight { currentpagedevice /PageSize get 1 get } def
			
<<
	/EndPage {
		2 eq { pop false } 
		{
			gsave
			watermarkFont
			watermarkColor
			pageWidth .5 mul pageHeight .5 mul translate
			0 0 moveto
			watermarkText false charpath flattenpath pathbbox
			4 2 roll pop pop
			0 0 moveto
			watermarkAngle rotate
			-.5 mul exch -.5 mul exch
			rmoveto
			watermarkText show
			grestore 
			true 
		} ifelse
	} bind
>> setpagedevice

ei46.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top