[Desktop_printing] Multi-Language PPD files and PPD file specs

Michael Sweet mike at easysw.com
Wed Jan 18 08:06:28 PST 2006


Johannes Meixner wrote:
> ...
> Results
> -------------------------------------------------------
> *CustomFoo True: "PostScript code snippet"
> *ParamCustomFoo Bar: 2 int -10 10
> *ParamCustomFoo Baz: 1 string 1 10000
> -------------------------------------------------------
> exactly the same as
> -------------------------------------------------------
> *CustomFoo True: "\1
> \2
> PostScript code snippet"
> *End

The \N syntax is ONLY used for JCL options, so you'd get literal
"\1" and "\2" in your PS command output.

> *ParamCustomFoo Bar: 2 int -10 10
> *ParamCustomFoo Baz: 1 string 1 10000

(note that the syntax for string values does not use numbers
for the minimum and maximum values, but instead uses a string
for each)

> -------------------------------------------------------
> so that with values "-9" for Bar and "Some Text" for Baz
> both result the following PostScript code:
> -------------------------------------------------------
> Some Text
> -9
> PostScript code snippet

Strings are encoded as PostScript strings, e.g.:

     (Some Text)
     -9
     PostScript code snippet

> -------------------------------------------------------
> 
> Is the ordering on the PostScript stack determined by the
> values for "order" in the PPD file and not by the ordering
> of the "Param..." lines in the PPD file?

Yes, just as for CustomPageSize, the order value determines
the order that the values are placed on the stack.

> If
> -------------------------------------------------------
> *CustomFoo True: "\1 \2 PostScript code snippet"
> *End
> *ParamCustomFoo Bar: 2 int -10 10
> *ParamCustomFoo Baz: 1 string 1 10000
> -------------------------------------------------------
> was specified in the PPD and if the value for Baz is a string
> with 10000 characters, could this lead to some string buffer
> overflow (e.g. in pstops) or to a too long line in the PostScript
> code?

Again, the maximum value is actually a string, e.g.:

      *ParamCustomFoo Baz: 1 string "" "*********"

would specify that the string value Baz can contain any character
and be 0 to 10 characters in length.

In any case, it would be up to the PPD writer to put the
correct limits in for the printer/driver.  The filters using
the CUPS PPD API won't care about the length - everything is
allocated and checked.

That said, the DSC limits the line length in PostScript files to
255 characters, and the PPD spec has a similar limit, so we
should probably limit custom string values to that length as
well.

> Is it possible to test for allowed characters in strings?

That's a really good idea; I've thought about using a really simple
format, e.g.:

      *ParamCustomFoo Baz: 1 string "A" "A********"

would mean Baz could be a string starting with a letter from 1 to
10 characters in length, while:

     *ParamCustomFoo Baz: 1 password "1111" "1111"

means Baz is a password string consisting of exactly 4 numbers.

The alternative would be to use a POSIX regex, however that would
be semi-difficult to implement on Windows... :(

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Document Software          http://www.easysw.com



More information about the Printing-summit mailing list