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

need help with procedures

Status
Not open for further replies.

Wolfie7873

Technical User
Jan 15, 2004
94
US
Can I do this?

/nextline { 0 1.2 ptsize mul rmoveto }

and then in context:

(Here's a line of text) 100 200 ms
nextline
(Here's the next line of text) show


Eddie
 
Yes. You have to complete your procedure definition, though, with a "def" or even better a "bind def". The bind operator forces early binding... meaning that the operators within the proc are replaced by the actual code in systemdict at time of defintion.

If your main concern is to sequentially "print" an arbitrary collection of strings down the page, may I suggest an approach?

Write your strings out to a file, terminating each with a valid line termination character or characters. Then use "readline" to pull them in and show them.

You can even write these strings to a PostScript program, and use the "currentfile" operator.

Your program structure might be as follows:

Code:
%!PS

/someProc 
{ x y moveto show
  % y would be a procedure to show a string and then
  % reposition to nextline
} bind def

/buffstr 256 string def

/readProc
{
  { currentfile buffstr readline
    exch someProc
    not {exit} if
  } loop
} bind def

readProc
(This is sentence one.)
(This is sentence two.)
(This is sentence three.)

I haven't tested this, but you should get the general idea.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
OK. I basically figured it out right after I posted. I have some stuff implemented already. I can center, left justify, right justify, and go to the nextline with proper leading reliably. I can make mulitple pages and do the BeginPage procedure.

I have since run into a rather peculiar error. I have made a two page document to test my developing code and I've been using ghostview to preview what I've implemented.

When I preview it I see the first page, and I can hit the arrow button and see the next page. But, when I hit the back arrow to go back to the first page I get an error: No Page Numbering Available and it won't go back to the first page. I find this rather peculiar since I have included:

%% Pages (atend)

in the begining comments and then each page begins with

%% Page: 1 1

or %% Page: 2 2 (as the case may be)

and then in %%Trailer
%% Pages: 2

any ideas why i get this error?
 
No. I don't use GhostScript, it often lags behind in operator support, or relies on DSC commenting when it shouldn't etc. So I can't help you there. The comp.lang.postscript newsgroup has a lot of Ghostscript users/supporters, you might try there.

Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Well, if i obviously don't need those page comments to get the file to work, I should be able to send the file to the printer and have everything work just fine without the page thing screwing it up, right?

Eddie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top