You are on page 1of 8

Mitutoyo CTL Germany Information 28.05.

2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

1. General

PDF files are an easy way to archive protocols and printouts on computer systems. You can easily
navigate through the PDF files and print them if it is necessary. They include also the benefit of
searching inside (depending on the Acrobat Reader version) and an easy way to zoom graphics etc.

You can view these PDF files with the ”Adobe Acrobat Reader”. This reader is distributed free of
charge from Adobe and can be found on your COSMOS-CD or at http://www.adobe.com.

2. How to create PDF files

There are two ways to create PDF files.

The first way is the commercial product “Adobe Acrobat”. This product installs additional printer
drivers that produce the PDF file. The benefit of the commercial product is that you can convert
word documents including embedded links etc. For more information about Acrobat have a look at
http://www.adobe.com. One disadvantage of this solution is that the output files cannot be
controlled by GEOPAK, i.e. you are requested to type the file name for each PDF document.

The second way is similar, but free of charge. This solution is based on Ghostscript, a software
PostScript interpreter which can also convert PostScript files to other formats like TIFF, PDF etc.
The licence term of Ghostscript does not allow a bundling with a commercial product; therefore you
must download the required software from the World Wide Web.

The installation of this solution is more complicated than the one of the commercial product. If you
are not familiar with the operating system, please consider using the commercial product instead.

If you compare the commercial solution with the free one, there are the following differences:
• The free solution can be controlled via a text based response file, this can be used to
suppress any additional user input (needed for the GEOPAK solution)
• The produced PDF files are in both cases similar, the quality of the PDF files vary
depending on the input data; in some cases the commercial product gives the better result, in
other cases the free one.
• Attention: The free solution does not work under Windows 9x, basically the printer spooler
of Windows 9x crashes.

The following chapters describe how to setup Ghostscript to print PDF files and how the pass the
PDF file name from GEOPAK to the printer driver.

Ghostscript is licensed under the AFPL Ghostscript license. This licence contains certain
restrictions to deliver Ghostscript with a commercial product. Based on these restrictions we offer
this solution free of charge as an option without support! This means we do not provide any support
related to the installation of Ghostscript, any problems with Ghostscript or the described solution in
this document.

For readers of an older version of this report: Controlling of the PDF file creation by
GEOPAK-Win has become much easier because of a new tool provided by us.

1/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

3. Required files

First of all you need the latest version of Ghostscript. Now at the creation time of this document it is
version 7.04. Ghostscript has only a poor command line interface. If you need a graphical user
interface and a viewer for PostScript, we recommend GSView. There is a link to this program from
the Ghostscript download page. GSView is also available for free, but the author of this package
requests a registration fee to support the further development of the software. Without this
registration fee the software starts with a nag screen. We need also a printer re-director, which is
available on the web, too.

The entry point for the download is http://www.cs.wisc.edu/~ghost/index.html.

There are some links on this page, please follow first the link to “REDMON” (this is the printer
redirector) and download the software. Now at the creation time of this document the REDMON
version is 1.7.

Go now back to the entry point (http://www.cs.wisc.edu/~ghost/index.html).

After this please follow the link to Aladdin Ghostscript (Obtaining AFPL Ghostscript).

On this page you find a self-extracting EXE file for Windows. Now at the creation time of this
document the file name is “gs704w32.exe”.

If you like to install GSView in addition you must also download the file “gsv412w32.exe”. You
find the most recent version, if you follow the link to GSView from the entry point
(http://www.cs.wisc.edu/~ghost/index.html). There is also a link to GSView from the Ghostscript
download page, but this link maybe is outdated.

4. Installation of Ghostscript and REDMON

Additionally for the installation you may need the CD of your operating system and administrator
rights on your system. Please remember if there is any service pack installed, you must re-apply this
service pack after the complete installation. The following screenshots are taken from Windows
2000 Professional. Windows NT and Windows XP may differ.

First of all unzip the printer re-director (REDMON) to a temporary directory of your choice. After
this, call the file “SETUP.EXE” from the REDMON package to install the software.

The next step is the installation of Ghostscript. Please start the file “gs704w32.exe” and follow the
installation instruction.

Please remember the installation directory of Ghostscript. We need this later.

This was the first turn, now we must install the printer for the PDF files.

2/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

5. Installation of the required printer drivers and configuration of REDMON

Please install now a new local printer driver on your computer (Control Panel / Printer / Add
Printer).

After the first selection (Local computer) you reach the next page with the port selection.

Now select the entry “Create a new port” with type “Redirected Port” and press the “Next>” button:
The following dialogue occurs:

After the confirmation of this dialogue with “OK” the following dialogue occurs, where you must
fill in the needed parameter for the printer re-director REDMON:

3/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

Please enter the displayed information and adapt the path “C:\GS” to your installation of Ghostscript
in this dialogue (the path “C:\GS” is the default installation path).

Now press “OK” and the “Add Printer Wizard” will appear again.

Choose now the RPT1 port in the wizard dialogue and press the “Next>” button to install the printer
driver.

4/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

The used printer driver must be a PostScript printer driver. Some printers have more than one
protocol interface, e.g. PostScript and a vendor specific interface like PCL. These printers need a
special initialisation sequence to activate the PostScript interface, e.g. Hewlett-Packard printers. The
printer drivers for these printers can not be used with Ghostscript. We strongly recommend using
the following driver:

Also possible is the Apple Laserwriter 16/600 PS or the Apple LaserWriter II NT v47.0. These both
drivers produce grey-scaled PDF files; the Apple Color Laserwriter produces coloured PDF files.
Now follow the rest of the pages until the driver is installed. We suggest to change the printer name
to “PDF Writer” or something similar.

5/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

6. GEOPAK integration

To make the integration in GEOPAK as easy as possible, we provide a small utility program
(“GS_RESP”), which produces the Ghostscript response file. This utility is installed together with
COSMOS and can be found in the COSMOS EXE folder.

For printouts GEOPAK uses separate jobs for graphics and text printouts. For this reason you must
work with the print format command of GEOPAK to control the creation of the PDF files.
Especially if you work with graphics you should set these commands before the graphic command
and after this command.

Therefore the following GEOPAK command sequence is recommended:


• Specify the print format
• Program call (GS_RESP with the name of the PDF file to be created)

The GS_RESP reads the parameters for Ghostscript from the already entered REDMON parameters.
Only the settings from port RPT1: are used.

6/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

In the following picture you see an example how you can control the print jobs in GEOPAK to
create separate PDF files for single pages:

In line 8 of the part program, there is a call to the mentioned utility program “GS_RESP. This
program has only one parameter, as you can easily see in this dialogue.

This parameter is the path and the name of the PDF file.

7. How to use the PDF printer from other applications

If you like to use the PDF printer also for other programs, e.g. MS-WORD we recommened to
install a PDF printer on a different port. The one for GEOPAK reads the name of the PDF file from
the response file.

Please follow the installation instruction, create a new redirector port, e.g. “RPT2” and enter the
following parameters (adapted to your installation path):

7/8
Mitutoyo CTL Germany Information 28.05.2002
Thema: Creation of PDF files with Ghostscript controlled by GEOPAK-Win
Author: S. Haubold

For the rest, please follow the original installation instruction. As a next step you have to create a
customised response file for this printer. The easiest way is to copy an automatically generated
response file from “GS_RESP” to the new name, open this file in an editor (e.g. Notepad) and
remove the line containing the “-sOutputFile=…” option.

You can now use this printer for all other applications. If you print to this printer, a dialogue box
will appear where you can enter the name of the PDF file.

8/8

You might also like