Postscript printer question

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Mar 13 21:41:32 UTC 2006


On Mon, Mar 13, 2006 at 11:40:39AM -0500, Madison Kelly wrote:
> Hi all,
> 
>   I've got a bit of a problem... I've got a perl script that looks at a 
> PS file that I print from OpenOffice2.
> 
>   The program (which I can't modify) reads the postscript and looks for 
> '~' (tilde) and substitutes in values where they are found. I have tried 
> creating a printer (the recommended printer is the Apple LaserWriter NT) 
> and told to print in PostScript level 1. Then I print a given document 
> to a file using this (dummy) printer.
> 
>   The problem is that when I look at the resulting PS file instead of 
> getting '~' where appropriate I am getting (the ASCII?) '<7E>' instead. 
> Has anyone run into this before? If so, any idea how to tell it to print 
> the tilde instead of the ASCII?
> 
>   As an aside, when the same printer in PS level 1 is used on MS' 
> Office the result is the tilde and I need to mimic this behavior.

Well after a quick look, if I did something like:

echo "abc ~ 123" | a2ps -o a2pstemp.ps

I get something which contains the code:
x0 y0 moveto
(abc ~ 123) p n

Which seems reasonable.

Do the same from open office with print to file and you get:
162 131 moveto
0 setgray
(TimesNewRomanPSMTHGSet1) cvn findfont 50 -50 matrix scale makefont
setfont
<616263207E20313233>

Where the stuff in <...> is the hex codes for the stuff that was ascii
in (...) above.

Of course this probably means it is reasonable to look for <...> lines
in the output from OOo parsing 2 characters at a time, looking for 7E
and replacing it with the hex encoding of the desired string, which
before you just had to look for ~ in (...) lines and replace that.

Or you can try and figure out how to make OOo not use the hex encoding,
although I suspect it has to do with unicode and other multilanguage
support and the fonts it uses, where perhaps on windows you are getting
a simpler ascii only version.  Even setting OOo to postscript level 1
did nothing to change the output.

Len Sorensen

Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list