[Gllug] hacking a post script file

Tethys tet at createservices.com
Tue Mar 16 14:47:42 UTC 2004


Simon Perry writes:

>I am trying to put a quick hack together to put a string of text into an 
>existing post script document but my brain is else where today. The text 
>string may already contain line feeds and needs to be split at those 
>feeds to preserve formatting or at every 50 chars otherwise. Anyone got 
>an elegant solution?

Yep. Unless you have a *really* good reason to do so, hacking the PostScript
is almost always the wrong solution. Hack the original document format, and
then regenerate the PostScript from that. It's possible to mess around with
PS strings and get a passable result in a few cases. But it's essentially
impossible[1] to do it for the general case. Even if you manage to insert
the string, you're going to throw off the layout of subsequent strings.

Tet

[1] OK, so it's possible. But it's an awful lot of work -- far more than
    makes it worth the effort, and you'll still only be guessing. The problem
    is that PS makes no guarantees that the characters in a given word will
    be in the same PostScript string. Trying to work out which ones actually
    form part of the same word is non-trivial.
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list