OS/2 eZine - http://www.os2ezine.com
Spacer
April 16, 2003

Do you have an OS/2 product or service you'd like to advertise?


Beginners Guide to Creating PDF's

Even if you don't have Adobe Acrobat, you can easily create .PDF files with OS/2. You can use any document software you want (e.g. word processor, spreadsheet, desktop publishing), as long as it can print with it, you can use it.

What you need

As an absolute minimum, you'll need to get Ghostscript for OS/2 (ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs800/gs800os2.zip). The latest version is 8.00. Ghostscript is a ubiquitous utility for various Postscript related tasks and is found on Windows, various UNIX flavours, Linux, DOS and possibly more. Don't worry, it won't cost you anything to try it. If you like it, consider donating to get rid of the nag screen, but otherwise, it is not disabled in anyway.

While you're at it, you should also download Ghostview 4.4 for OS/2 (ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv44os2.zip). It is a graphical front end for Ghostscript. On top being a pretty interface, it makes installation a lot easier. If you have Ghostscript and Ghostview, installation is simple. Unzip only the Ghostview archive, which should be in .ZIP format. Make sure the Ghostscript archive is in the same directory, but do not unzip it!. Now run OS2SETUP.EXE from Ghostview and follow the prompts in the installation program. That's it! (If you don't want Ghostview, you'll have to read the instructions on how to install Ghostscript by itself). Ghostscript is super handy, it will even let you view the newer messed up .PDF files that Acrobat Reader 3 chokes on. You can also use it to convert Postscript or EPS files to PCX, BMP, PNG, GIF or JPEG image files. [Those newer .PDF files really are messed up. It isn't OS/2's fault. The "bug" was in Adobe Acrobat 4, but has since been fixed in Adobe Acrobat 5, so if you find a buggy .PDF, you'll know it was generated by someone who used Acrobat 4 and didn't read the instructions on how to fix the problem].

Method 1: Use Ghostview/Ghostscript manually

If you don't want to fuss with installing anything else, you're almost all ready to go. The one requirement? You must install a Postscript printer driver. It doesn't matter if you don't have a Postscript printer, just install one anyways. If you're going to be preparing colour .PDF's, be sure to select a colour capable Postscript printer. (I just chose an HP Color LaserJet 8550 PS).

Step 1: Prepare your document in whatever program you like. (e.g. WordPro, DeScribe, Mesa, etc). Nothing new or special here, isn't that simple?

Step 2: Print your document. For the printer, don't forget to choose the Postscript printer you installed, and be sure to check the "Print to file" option if it's available. If it is not available in the print dialog (e.g. IBM Works), then you need to manually setup the printer driver. I haven't seen any application which doesn't have a "Print Setup" option. It will take you directly to the dialog which configures the printer.

By default, printers are set to print to "Printer", of course. You need to change it to "Raw Postscript file" and you'll also need to enter a filename. If you want a new filename, sorry, you'll have go to the setup each time you print and type in a new filename, else it will ask if you want to overwrite the old one.

Step 3: Go find the Postscript file you just printed out. If you have Ghostview setup properly, you should be able to just double-click on the file and it will open it up with Ghostview. Don't worry, almost finished, it takes longer to describe than to do.

Step 4: Now in Ghostview, go to the "File->Convert" menu. It should pop up a dialog like this one. Be sure to select "pdfwrite" for the device if you want to create a .PDF document.

If you just click "Ok", it will prompt you for a filename to save the .PDF file as and then go ahead and convert the file. But I should point out a few things about the conversion.

Now if this still sounds too complicated for you, then you are ready for something more automated...

Method 2: Using ePDF or PMPDF

PMPDF (http://pmpdf.netlabs.org/) is available from Netlabs (http://www.netlabs.org), and ePDF (http://www.subsys.de/ePDF/) is also a free download. Both still require that you have Ghostscript installed.

I'll describe PMPDF, but ePDF is very similar (maybe it even springs from the same code). PMPDF comes as a WarpIn (http://www.xworkplace.org/proj_warpin.html) archive, so installation is really easy. It even sets up a printer object for you clearly labelled "PDF Writer". The only thing it asks for during installation is the location (path) to your Ghostscript installation. (One thing to note, when you setup the configuration for PMPDF, select the output to be "Screen", not "Default", "Printer" or "Pre-Press", these won't work. The dialog does note which one is OS/2 compatible anyways).

Once it is setup (no reboot required), creating .PDF's are really easy. Just print your file to "PDF Writer" and that's it. No messing around, you don't even have to change any settings to "Print to file" or whatever. Just hit "Print".

PMPDF

A little dialog will pop up asking you where to create the file. Just select the directory, type in the filename and click "Write PDF". It's that simple! File creating happens in the background so you can go about doing other things (if it's a particularly large file). It will give an audible beep when it is finished.

Font Tips

These apply no matter which method you are using. I mentioned a Ghostscript "bug" which converts certain fonts it doesn't "know" about to bitmap fonts. These still print fine, provided you have cranked up the resolution enough. You can also play with the FONTMAP file in Ghostscript to try and get things converting to .PDF nicely. You can also try installing new fonts to your "fake" printer. When you add fonts to a Postscript printer, you'll need to get at the driver properties page (not the "Job properties...").

Print Driver Properties

From there, work your way to the "Font Manager" tab so you can add other fonts. I think by default, no font files are loaded into printer memory.

You can add any Postscript font you want. What you'll want is the .PFB file that goes with the font. If you get it wrong, you'll get an error message, so don't worry. Does it help to add fonts? Probably, though I haven't gone too much into the details to be able to report it here. I always just stick with a couple of fonts that I know work.

If you want your documents to always look good, "Helvetica" always works. Sometimes Helvetic Italic can be a problem, so you can substitute Helvetica Oblique, unfortunately this doesn't look italicized on screen. By default (i.e. no FONTMAP tweaking), I've found some fonts work well, and some do not. I've got the PS fonts that came with OS/2 and Lotus Smartsuite. Grouped by somewhat similar appearance:

All the above assumes that you have "Use printer device fonts" and "Use downloaded fonts" selected in the "Job Properties" setup. This is already done by default in PMPDF, but you won't be able to do this to work around the WordPro problem I describe below.

Using Freelance Graphics

Freelance gets its own special section because of a particularly troublesome bug. However, it will only bother you if you are using the "manual" method of generating Postscript/PDF files. For some reason, Freelance does not respect the "Print to file" option in its own print dialog. Not even the "Print Setup" will work. The only way to print to a Postscript file from Freelance is to go into "Printers" folder, select the printer, bring up the "Job properties..." page.

Setting up in Freelance

This will take you to the "Properties" page which you can setup (just like the screenshot described earlier on) the printer to print to "Raw Postscript file". When you print from Freelance then, print as normal (do not click "Print to file"), and a proper Postscript file will be generated. Remember to undo this if you are printing from another application.

Using WordPro

Another big section goes to WordPro, which has even more serious problems! In fact, this one is so complicated, I haven't figured out all the details yet.

If you are just preparing a plain text document, with no mathematical formulas, you should have no problem. If you do use equations, then you are in for a rough ride. These apply whether you use ePDF, PMPDF or the "manual" method or even printing to a printer! It's a basic problem with WordPro printing to Postscript. Here are some rough rules that I follow to try and make things work.

I really don't know what's going on. It's very difficult to get any document with equations printed properly (screen or printer!). If any of you have a subscription contract with Lotus, please get them to fix this bug. StarOffice seems to print equations just fine, and even WordPro seems to handle it nicely if I print to a PCL printer.

At the very least, if you understand this bug and know exactly how to work around them, please, please, please let me know. WordPro is the only wordprocessor (except LaTeX, ugggh!) which has the features I need, but for this one killer bug.

Conclusion

Alright, enough whining about WordPro. I hope this short intro has shown you, in general, how easy and simple (especially with PMPDF) it is to create nice Acrobat .PDF documents under OS/2 with all free tools. You don't need Adobe Acrobat and Windows, unless there are some particularly complex features of Acrobat documents that you need to access. I know there are some special features, but I've yet to encounter any document on the Web that uses them!


Related Links

ePDF (http://www.subsys.de/ePDF/)
PMPDF (http://pmpdf.netlabs.org/)
Ghostview (http://www.cs.wisc.edu/~ghost/gsview/get44.htm)
Ghostscript (http://www.cs.wisc.edu/~ghost/doc/AFPL/get800.htm)
WarpIn (http://www.xworkplace.org/proj_warpin.html)


Isaac Leung got a degree in Engineering Physics and then Electrical Engineering after which he promptly got a job as a product engineer at a company which makes high speed datacom chips. He is old enough to have cut his computer teeth on Commodore 64's and first played with OS/2 1.3 EE while at a summer job with IBM. The first PC he ever owned came with Windows 95, but he soon slapped on OS/2 Warp 3 and has been Warping ever since. In his spare time, he plots to take over the world.

This article is courtesy of www.os2ezine.com. You can view it online at http://www.os2ezine.com/20030416/page_5.html.

Copyright (C) 2003. All Rights Reserved.