0

I'm trying to put a stamp on the top right corner of a PDF file. I have a PS file created from Excel using driver for HP Color LaserJet 4500 printed to file.

I am using GhostScript to create a PDF.

GSWIN32C.EXE @S:\Temp\PS\Options.txt

Here is the contents of the Options.txt file:

-sDEVICE=pdfwrite -q -dSAFER -dNOPAUSE
-sOUTPUTFILE="S:\Temp\PS\Sample.pdf" -dBATCH
"S:\Temp\PS\Stamp.txt"
"S:\Temp\PS\Sample.ps"

Here is the contents of Stamp.txt modified from here:

<<
   /EndPage
   {
     2 eq { pop false }
     {
         gsave
        /Helvetica_Bold 15 selectfont
       0 setgray
        475 767 moveto
        (STATE COPY) show
         grestore
         true
     } ifelse
   } bind
>> setpagedevice

The PDF is created just fine, but the stamp is causing me problems. The stamp shows very tiny on the upper left but flipped vertically.

Here is a section with the tiny stamp upper left: PDF with tiny stamp upper left

Here is the stamp enlarged 800%

Stamp enlarged 800%

On a multi-page PDF I want the stamp on all pages. I understand that using the /EndPage should let me do that.

So how do I get my stamp on the upper right corner?

Community
  • 1
  • 1
D_Bester
  • 5,723
  • 5
  • 35
  • 77
  • This http://stackoverflow.com/a/25187584/2559297 gets rid of the extra pages but doesn't solve the small, flipped stamp upper left. – D_Bester Oct 28 '15 at 18:07

1 Answers1

0

I assume the problem with the stamp resides in the previous transformations. So I used scale to flip the stamp upright and adjusted until I got it in the right place.

<<
 /EndPage
 {
   2 eq { pop false }
   {
     gsave      
    /Helvetica_Bold 15 selectfont 
    0 setgray
    10 10 scale
    375 17 moveto
    1 -1 scale
    (STATE COPY) show 
     grestore
     true
   } ifelse
 } bind
>> setpagedevice

I didn't test it but I assume using a different print driver to produce the PS file would give different results.

D_Bester
  • 5,723
  • 5
  • 35
  • 77