×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

text replacement

text replacement

text replacement

(OP)
I want to make some text replacement in a postscript job. How can I do this. for example, I have this:

%!PS
 
/Courier 24 selectfont
10 600 moveto (This is a test) show
10 500 moveto (%%redcolor%%) show
10 400 moveto (This is a color changing test) show
10 300 moveto (This is a test) show
showpage

What I would like to do is the replacement of the string %%redcolor%% with this:
0.83 0.00 0.00 setrgbcolor to change the color of the text.

Thank's in advance for your help

RE: text replacement

I think what you want is to be able to define a dictionary entry redcolor so you can switch to red when necessary. For instance, try this:

CODE

%!PS

/redcolor { 0.83 0.00 0.00 setrgbcolor } def
 
/Courier 24 selectfont
10 600 moveto (This is a test) show
%10 500 moveto (%%redcolor%%) show
%I do not understand why you are moving to 10 500
%if you just wanted to switch the color, but I may
%misunderstand what you are trying to do
redcolor
10 400 moveto (This is a color changing test) show
10 300 moveto (This is a test) show
showpage

In this example, "This is a color changing test" and the second "This is a test" will both show as red since the color has changed. If you just want the "color changing" line to print red, place a gsave before redcolor and a grestore after show, or define a "blackcolor" as a similiar entry and place blackcolor after the show.

The redcolor can then be modified to whatever shade you need and used whereever you wish throughout the document.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close