Prescribe to Postscript Converter


This is a little package to convert Prescribe, the printer language used by Kyocera's F-series laser printers, into the somewhat more popular printing language Postscript. It was written for two purposes: One, to display Prescribe graphics on-screen, using a Postscript interpreter like Ghostscript, and two, to print these documents on Postscript printers without the need to change the source application. These days, PDF is a more popular file format than Postscript; again, Ghostscript can be used to convert the Postscript files generated by this tool into PDF files.

Although the program does make a honest attempt at conversion, and works well for my needs, it's far from being perfect. Some features aren't fully implemented, some may behave differently as the original, and others aren't implemented at all. I have currently no intention of further improving the program unless I get some good motivation; but I'd be happy to receive fixes and contributions. I would be interested to hear it's of use elsewhere, though.

Features and Limitations

There's not much point in listing the program's "features". It does what it does without making fuss about it. It reads its input file from standard input and writes Postscript to stdout. But here are some of the limitations:

Compilation and Installation

Simply run ./configure, then make, and finally copy the resulting executable, p2p, to a location of your choice.

This package requires either bison or yacc and GNU flex. If flex is not available, the configuration script tries to use lex, but since a few advanced features of flex are used, a native lex will probably not work.

You also need a C preprocessor, cpp. If the configuration script does not find cpp on your system, set the location by invoking ./configure with --with-cpp=/where/ever. The preprocessor must accept the -P parameter in order to not generate #line statements.

Macro Replacement

The converter does not accept Prescribe macros by itself. They must be preprocessed in order to work properly. Given the '-m' command line switch, the converter will not produce Postscript code, but it will re-write all macros as C preprocessor #define statements.

Command Line Switches

  p2p [Options ...] [file ...]
In normal operation, the input files are concatenated, interpreted as Prescribe data (and are assumed to contain no Prescribe MCROs), converted to Postscript, which is written to standard output. If no input file is given, data is read from standard input.

The following options are accepted:

-o name
Writes output to name instead of standard output. If name contains %d, it is replaced by the current page number (i.e. each page is stored in a separate file).

-e encoding
Selects the codeset to use, where encoding can be iso8859-1 (default), laserjet or pc (MS-Dos code page).

-f ftmd
Sets the initial FTMD font mode (default is 15).

-c
Prints the original Prescribe input as comment within the Postscript code. Use if you're curious about what p2p does with your file and you care to read Postscript.

-m
Don't do Postscript conversion but replace macro calls. The output must then be fed through a C preprocessor before it can be converted. The preprocessor must be instructed not to print linemarkers, and to preserve comments. Using GNU CPP, this means using the "-P" and "-C" command-line options.

-a
Does both macro call resolution and Postscript conversion by calling the C preprocessor internally. Requires correct setup at compile time. Not available on Windows.

-s scale
Scale the Postscript output page. scale is a floating-point number where >1 means zooming and <1 means shrinking. (Both X and Y coordinates are multiplied with scale.)

-tx/ty offset
Translate the Postscript output page. offset is a positive or negative floating-point value in points where postive means a translation to the right (tx) or up (ty). (offset is just added to X (tx) or Y (ty) coordiates in normal Postscript point coordinates.)

-ux/uy margin
Adjust the left (ux) or top (uy) unprintable area, where margin is a positive floating-point value in points. Printing will start margin points from the left (ux) or top (uy) edge of the paper. Default is 13.5 points for both values.

-p
Disable the DSC (Document Structuring Convention) comments that p2p normally generates. Use if your Postscript interpreter/printer does not like them.

-d
Enable the parser's (bison's) debugging output, sent to stderr. Use if the conversion breaks and you don't know why.

License

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Free for non-commercial use. Feel free to modify the source code. If you want to use it in a business enviroment or even distribute it for commercial use, or along with your code, send a reasonable donation. Iif you fix bugs or add support for currently unsupported Prescribe commands, please contribute the changes.

Code


Frank Pilhofer <fp -AT- fpx.de> Back to the Homepage
Last modified: Sat Nov 1 13:11:14 2008