[comp.lang.postscript] Problems with PSlinewrap from the Adobe server.

lau@kings.wharton.upenn.edu (Yan K. Lau) (07/30/90)

I got the PSlinewrap program from the Adobe server.  We are having some
problems.  This is how we use it.  We have  applications on the PC that
generate PostScript output to a file.  We also have ethernet cards in our
PC ATs so we can printer via remote printing to a Unix machine.  Since the
Unix lpd has problems with lines longer than 132, we use the line wrap
program on the PC to make the lines shorter before sending to the printer.

The error we get is "ERROR: undefined. OFFENDING COMMAND: \ "
There is nothing on  the stack.  I am sure that the commercial packages
(eg. PCTeX, Quattro, WordPerfect) are generating correct PostScript.  Also
the problem seems to be dependent on the PostScript file since it only
happens sometimes.

Has there been problems with the wrap program?  Is there a better wrap
program around?

(aside: are there any Unix BSD gurus out there that can tell me how to put
a filter on the other side?  I know the entire file is sent.  Truncation
seems to occur on the output side. )


Yan.
   )~  Yan K. Lau    lau@kings.wharton.upenn.edu      The Wharton School
 ~/~   -Sheenaphile-          128.91.11.233       University of Pennsylvania
 /\    God/Goddess/All that is -- the source of love, light and inspiration!

glenn@heaven.woodside.ca.us (Glenn Reid) (08/03/90)

In article <27604@netnews.upenn.edu> lau@kings.wharton.upenn.edu (Yan K. Lau) writes:
>I got the PSlinewrap program from the Adobe server.  We are having some
>problems.  This is how we use it.  We have  applications on the PC that
>generate PostScript output to a file.  We also have ethernet cards in our
>PC ATs so we can printer via remote printing to a Unix machine.  Since the
>Unix lpd has problems with lines longer than 132, we use the line wrap
>program on the PC to make the lines shorter before sending to the printer.
>
>The error we get is "ERROR: undefined. OFFENDING COMMAND: \ "
>There is nothing on  the stack.  I am sure that the commercial packages
>(eg. PCTeX, Quattro, WordPerfect) are generating correct PostScript.  Also
>the problem seems to be dependent on the PostScript file since it only
>happens sometimes.

Well, I wrote that PSlinewrap program, and since your note hasn't gotten
a flurry of responses, I'll give it a shot.

The idea behind PSlinewrap is that you can't just wrap lines in a
PostScript file in arbitrary places and expect the program to still
work.  So the linewrap program looks at the syntax of the file and
tries to break lines such that the lines will be no longer than you
tell it, but only to break the lines in between tokens, etc.

The problem is that string bodies can be longer than the required line
length, and there is no choice other than to wrap the string bodies
themselves.

PostScript language syntax allows for wrapping string bodies without
disturbing their contents by putting a backslash as the very last
character on the line.  The red book says something like
"backslash-newline is ignored in a string body," meaning that there is
no extra character in the string when it gets to the interpreter.

The difficulty you are having stems from this, somehow.  Possibly the
backslash is having extra space added after it so that the backslash
is no longer immediately followed by a carriate return.  Another
possibility is that lines are being broken this way that aren't inside
string bodies, which would be a bug in PSlinewrap.  If you have a
short file that causes this problem and you can't otherwise solve the
problem, send me a test file at the address below, and maybe I can fix
it for you.  I'm not even sure, however, that I still have a copy of
PSlinewrap, although I must have it somewhere :-)

Another possibility is that your PostScript interpreter is broken and
doesn't know about the backslash syntax in string bodies, if you using
a non-Adobe printer.

/Glenn

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785