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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert PDF annotation based on setpagedevice changed stock

Status
Not open for further replies.

pstuart

IS-IT--Management
Jun 11, 2006
1
US
I'm hoping to add a pdf annotation using pdfmark to old postscript files that do tray switching based on setpagedevice commands.

I've got the pdfmark annotation code but I'm stuck on how to search for specific setpagedevice calls and basically place that call as an annotation text.

For example:

Assuming the first tray call is:
<< /PageSize [792 1224] /MediaType (STOCK1) >> setpagedevice

I'd like to add a new line after setpagedevice to insert the following line:
[/Rect [0 0 1 1] /Subtype /Stamp /Title (STOCK1) /Contents (This is where a different substrate should change to Tray 1) /ANN pdfmark

Then somewhere down the ps file the next media call is like this:
<< /PageSize [792 1224] /MediaType (STOCK2) >> setpagedevice

so I'd like to stamp this with a slightly different annotation:
[/Rect [0 0 1 1] /Subtype /Stamp /Title (STOCK2) /Contents (This is where a different substrate should change to Tray 2) /ANN pdfmark

What I am stuck on is how to switch this and what the proper code for a prologue.ps file would be and how to best achieve this result. Worst case, if I could just capture one or the other setpagedevice calls, I could then figure out where the rest of them go.

Any help would be greatly appreciated!
 
If the PostScript files do not re-define "setpagedevice" themselves, you can re-define "setpagedevice" in the prologue.ps file:

/ORIGsetpagedevice /setpagedevice load def % Save the original
/setpagedevice
{
dup % Get copy of dictionary
...<code to inspect dictionary and run commands based on what is found>...
ORIGsetpagedevice % Now do the normal command
}
bind def

Thanks
Scott Prouty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top