GhostScript and GhostPCL are applications mainly used in Unix-like operating systems such as Linux or FreeBSD for handling PostScript and PCL documents. PostScript is a programming language developed by Adobe for describing printable document pages. As a competitor Hewlett Packard developed computer language PCL. Both evolved from languages for simply describing page content to now include printer control and status retrieval aside from many other useful features partly implemented using related languages and file formats such as PPD and PJL.
On behalf of a client we integrated support for either language in a printer accounting system. For detailed document analysis both applications have been patched to provide meta information on processed documents separately for easy parsing. This enables observing processes to find out number of pages in document and what size every page is and whether or not its using colours.
Download Patch
You need to download one of the following patches matching the source version of either software in use.
ghostscript-gpl-8.56-analysis.patch.gz
ghostscript-gpl-8.62-analysis.patch.gz
ghostpcl_1.4.1.patch.gz
Installation
The downloaded patch is applied on available source tree. Then you may compile and install the software as usual.
Usage
Both applications gs und pcl6 may be used as before. By setting selected environment variables features introduced by patch are being enabled. These are the supported environment variables:
- TOXA_FILEDESC holds an integer selecting a file descriptor to write analysis information to. If this is omitted or exceeding valid range (1-255) no analysis meta information are generated at all. This is the usual case allowing normal use of either binary.
- TOXA_REDUCE_COLOUR is a boolean switch. It's evaluating as true as soon as it's set not regarding it's actual value at all. If set, only the first occurrence per page of selecting a colour is provided. This might cause highly reduced amount of analysis output on selected documents requiring less parsing and thus may remarkably improve analysis performance.
- TOXA_REDUCE_BITMAP works similarly to TOXA_REDUCE_COLOUR. It's a boolean switch as well. If set use of bitmaps is indicated without providing every used bitmap's dimensions.
- TOXA_BITMAP_MINWIDTH=x and TOXA_BITMAP_MINHEIGHT=y are both optionally available to limit set of reported bitmaps. If set, related dimension of a bitmap has to match selected minimum for being included in report. This is very useful to reduce reports on pages containing bitmaps font text consisting of one bitmap per letter or special character. Values x and y are replaced by integers providing amount in points. They might be combined with TOXA_REDUCE_BITMAP.
- TOXA_NO_PREFIX is another boolean switch like TOXA_REDUCE_COLOUR. If set, analysis meta information lines aren't prefixed by ANALYSIS: helping to reduce size of analysis information.

