|
A popular topic of discussion on the PTC/USER exploder list over the years is how to convert a Pro/ENGINEER drawing to Portable Document Format (PDF) so that the file can be distributed easily and securely.
One method of producing a PDF file is to use the Adobe® Acrobat® family of products from Adobe Systems Inc. This software, however, is not without purchase and upgrade costs. Over the years, AFPL (Aladdin Free Public License) Ghostscript has emerged as a good alternative for converting postscript language files to PDF. The AFPL version of Ghostscript allows free use, copying, and distribution by end users (but does not allow for commercial distribution).
AFPL Ghostscript is readily available for download from the Internet. FreeDist is a freeware program that acts as a front end for Ghostscript, which is also available on the Internet. Together, they provide functionality similar to Adobe Acrobat Distiller®.
Converting a postscript language file to PDF using Ghostscript is straightforward. A Pro/ENGINEER drawing is printed using a specific plotter configuration file (.pcf) to create a postscript file. The postscript file is automatically placed into a specific directory defined by a config.pro option. FreeDist constantly scans this directory for incoming postscript files. When one arrives, FreeDist activates Ghostscript, which in turn automatically converts the file to PDF. The resulting PDF files can be then be viewed with Adobe Acrobat Reader® or a similar PDF viewer.
On an individual basis, it is relatively simple to retrieve single- or multi-sheet drawings into a Pro/ENGINEER session, print them as postscript files, and then use FreeDist and Ghostscript to convert to PDF. When a number of drawings of varying sizes or sheets needs conversion, though, using Pro/BATCH is a good way to automate the postscript creation process. Two major benefits of Pro/BATCH are its ability to run up to 24 hours into the future, and to run Pro/ENGINEER without displaying graphics. The suppression of graphics means that Pro/BATCH runs very quickly, even when retrieving large assembly drawings. In fact, you can generate hundreds of postscript files in a matter of minutes.
Getting all the software pieces to work together requires some initial configuration. The first task is the download of Ghostscript and FreeDist from the Internet. As of this writing, the latest copy of Ghostscript is version 8.00. It can be downloaded from:
http://www.cs.wisc.edu/~ghost/doc/AFPL/index.htm
The latest copy of FreeDist is version 1.10 and is available from:
http://home.hccnet.nl/s.vd.palen/index.html
Before installing Ghostscript and FreeDist, you should create some system directories. For reference, I have created the following directories on my Windows 2000 workstation.
c:\pdfs
c:\pdfs\in
c:\pdfs\out
c:\pdfs\compose
c:\freedist
After downloading the Ghostscript executable, simply double-click the file to start the installation process. Keep the default installation location of c:\gs. You should also install Ghostscript fonts (Fig. 1).

Figure 1. Ghostscript install dialog
To install FreeDist, put the executable obtained from the Internet in the c:\freedist directory. Place a shortcut on your desktop if you desire.
After starting FreeDist, the program dialog will look similar to Figure 2.

Figure 2. FreeDist main screen (click to enlarge)
You need to configure the correct path to each piece of required information in FreeDist. Select a radio button on the main screen and refer to Table 1 for the values. Once FreeDist is configured, select the Start Distiller radio button and the program will monitor the watched directory for incoming postscript files.
Note: These instructions assume you are running Adobe Acrobat Reader 6.0 and Ghostscript 8.00. If you are not, you will need to modify the program paths for your specific installation.
Table 1. FreeDist program paths
| Program |
Program Path |
| Ghostscript |
c:\gs\gs8.00\bin\gswin32.exe |
| Acrobat Reader |
c:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe |
| Watched Folder |
c:\pdfs\in |
| PS Move to Folder |
c:\pdfs\out |
| PDF Output Folder |
c:\pdfs\out |
| PDF Compose Folder |
c:\pdfs\compose |
To obtain the correct output in the postscript file, you must first create a plotter configuration file. This file is a text file I have called pdf_win.pcf (Table 2). For this file to be available for use in Pro/ENGINEER, set the following config.pro option and put the plotter config file in this location. (Your drive and directory path may vary).
pro_plot_config_dir f:\plot_cfg
Table 2. Plotter configuration file entries (pdf_win.pcf)
| button_name |
pdf_win |
| button_help |
Create Postscript file for Ghostscript based on paper size |
| plotter |
postscript |
| paper_size |
a b c d e |
| plot_sheets |
all |
| plot_destination |
file |
| pen_table_file |
f:\plot_cfg\table_pdf.pnt |
The pen_table_file option in the plotter configuration file sets the path and file name of the pen mapping file. The pen mapping file is a text table that defines the line width in the output file based on the entity color in Pro/ENGINEER. From experience, I have found that the values in Table 3 produce acceptable output lines in the printed PDF file.
Table 3. Pen mapping file (table_pdf.pnt)
pen 1 thickness 0.015 cm;color 0.0 0.0 0.0;letter_color
pen 2 thickness 0.020 cm;color 0.0 0.0 0.0;drawing_color
pen 3 thickness 0.015 cm;color 0.0 0.0 0.0;dimmed_color
pen 4 thickness 0.020 cm;color 0.0 0.0 0.0;magenta_color
pen 5 thickness 0.020 cm;color 0.0 0.0 0.0;brown_color
pen 6 thickness 0.015 cm;color 0.0 0.0 0.0;hilite_color
pen 7 thickness 0.015 cm;color 0.0 0.0 0.0;half_tone_color
pen 8 thickness 0.020 cm;color 0.0 0.0 0.0;cyan
pen 9 thickness 0.200 cm;color 0.0 0.0 0.0;blue
pen 10 thickness 0.025 cm;color 0.0 0.0 0.0;attention_color
Finally, to allow the postscript file output from Pro/ENGINEER to be written to the FreeDist watched directory, set the config.pro option to:
plot_file_dir c:\pdfs\in
You should now be able to retrieve a drawing into Pro/ENGINEER and then print it. In the drop-down menu of available printers in Pro/ENGINEER, select pdf_win as your printer. After printing, the file will be placed into the FreeDist watched folder. If FreeDist is already running, the PDF file will be created automatically and placed into the PDF Output Folder.
Pro/BATCH is a Pro/ENGINEER utility. The batch file to start the program is located in the <proe loadpoint>\bin directory and is named pro_batch.bat.
Since Pro/BATCH runs without user interaction, you must make sure the output from Pro/ENGINEER is going to look correct. In most instances this means datum planes, axis, coordinate systems, spin center, and datum points should not be displayed. Add the following options to your local config.pro file:
spin_center_display no
axis_display no
datum_display no
datum_point_display no
display_coordinate_system no
When you are finished with Pro/BATCH, you can either remove these options or re-set their values.
Before running Pro/Batch, check out the object(s) to print from Pro/INTRALINK. You will need to export the drawings from the workspace to a local directory on the disk.
Note: While it is possible to take the back door approach and pull files directly from the .proi\<workspace name> directory, PTC does not recommend doing so. This is due in part to the way Pro/INTRALINK handles renamed objects in the Commonspace and the .proi directory. The safest approach is to always export the drawings to disk before running Pro/BATCH.
Copy the plotter configuration file to the startup directory of Pro/ENGINEER. This will allow you to select it as the plotter in Pro/BATCH.
Pro/BATCH can now be started. On the main screen, type in a name in the area next to Batch File (Fig. 3). For the Pro/ENGINEER Command, enter the complete path and name of the Pro/ENGINEER batch file, e.g., c:\ptc\proe2001\bin\proe2001.bat.

Figure 3. Pro/BATCH main screen (click to enlarge)
Select File, Browse and then filter for drawing files. Highlight the drawing files to plot and then choose Add Objects (Fig. 4). Select Close Browser when complete.

Figure 4. Pro/BATCH file browser
In the Pro/BATCH main screen, highlight all of the files in the list and then select Options, Set Option. In the Set Option plot dialog box (Fig. 5), use the pull-down to select the plotter configuration file (pdf_win) as the plotter. Set the Paper Size to FORMAT_SIZE and then set the Output File Filename to *.ps. Select OK to exit this dialog.

Figure 5. Set Option plot dialog (click to enlarge)
At this point, all of the options necessary to run Pro/BATCH are set. Before starting the batch process, you must save the batch file. To start the conversion process, select Schedule, Start the Task (Fig. 6). You can set the batch file to run immediately or up to 24 hours in the future.

Figure 6. Pro/BATCH schedule dialog
When the batch processing is complete, the Pro/BATCH Status dialog box will show a Finished status and a Done result (Fig. 7). If a failed status is returned, it means Pro/ENGINEER could not regenerate at least one drawing in the group. You will need to investigate this manually in Pro/ENGINEER and resolve any failures before attempting to use Pro/BATCH again.

Figure 7. Pro/BATCH status dialog
Start FreeDist if is not already running. The postscript files in the watched directory will automatically be converted to PDF and then moved to the PDF Output Folder.
This article presents a straightforward, no-cost solution to PDF creation that will work for single Pro/ENGINEER drawings, multi-sheet drawings, or multiple drawings. Using this approach, you can quickly create single PDF files or, using Pro/BATCH, multiple PDF files in a minimum amount of time. 
Anthony Troglio is CAD System Administrator at Sunnen Products Company in St. Louis, Missouri. He can be reached by email at ttroglio@sunnen.com.
|