VOICE Home Page: http://www.os2voice.org | [Newsletter Index] [Previous Page] [Next Page] [Features Index]

March 2000
editor@os2voice.org

#
Ghostview 2.8 and
Ghostscript 6.0

By: Mark Dodel madodel@ptd.net

Besides the rumours of a new OS/2 client in the offing, there has actually been quite a bit of new development in the OS/2 world of late. CDS has released a new version of Back Again/2000, the Odin project has made great strides in allowing us to run win32 apps, KeyRing/2 was released, a new release of the betas for Stellar Frontier as well as Scitech Display Doctor and a bunch of other OS/2 applications have been updated. Among those is Ghostview. Ghostview is a graphical interface for Ghostscript. Each is a separate product by a different developer. Ghostview is written by Russell Lang at Ghostgum Software Pty Ltd. Ghostscript, which is a command line post script interpreter, is a product of Aladdin Enterprises . Both products are free for normal use, though they must be licensed for commercial paid distribution according to the Aladdin Free Public License http://www.cs.wisc.edu/~ghost/aladdin/doc600/Public.htm.

### What is Ghostview/Ghostscript?

Ghostview is a reader for Adobe postscript/PDF files. Basically a replacement for the Adobe Acrobat reader. Why do we need a replacement? Simple, there has been no development on Acrobat for OS/2 beyond version 3.0, which is now almost three years old. There is a beta java version of Acrobat Viewer 1.1, but it is extremely slow, and buggy at this point. Why should you care? Well documentation is going in two directions at the moment - HTML or PDF. For HTML we have Netscape Communicator, at least for now, which is fairly up-to-date. But for PDF we have the aging acrobat for OS/2. As Adobe continues to refine and update the Postscript Document Format, it will become increasing more difficult to view documentation based on PDF.

One of the other important features of Ghostview over Acrobat is that Acrobat is strictly a viewer, while Ghostview can convert viewed formats to other formats. There is no Adobe distiller for OS/2 (a PDF development tool used to create PDF document files). But you can print a document to a postscript file, then view it with Ghostview and then save it in PDF format. some folks have had some success running Adobe's PDF Distiller under OS/2 using Odin (the win32 -OS/2 project now under the auspices of Netlabs - http://www.netlabs.org/odin).

Ghostview is available for both OS/2 as well as the win32 platform. Ghostscript is available in Unix/VMS,OS/2, DOS, MAC and windows versions.

### Installation

This is the most surprising part for me. I had tried installing Ghostscript a couple years back and finally gave up in frustration. With Ghost view you just unzip the most recent archive into a temporary directory. The 2.8 version of Ghostview is 756,367 bytes. You also need to download the most recent version of Ghostscript into the temporary directory. Ghostscript is currently at version 6.0 and is 4,635,230 bytes. Don't unzip this archive.

Next run the Ghostview os2setup.exe. Ghostview 2.8 will support versions 4.0 to 6.99 of Ghostscript so as part of the installation you have to tell it which version of Ghostscript you are installing. You can also choose to install either or both of these components. You also have to enter a main directory to install it to. Ghostview and Ghostscript are then installed to separate subdirectories and a Ghostview desktop object is created. The beauty of installing Ghostview, is that you don't have to know anything about the command line Ghostscript. Ghostview takes care of everything.

The installed Ghostview uses about 1.1Meg of space, Ghostscript about 6Meg. In addition about 3.8Meg is used for fonts.

### Ghostview in Action

Ghostview differs from Acrobat in many ways. when I first tried to read a PDF file, I noticed that the Index frame was missing on the right and I kept hitting the Page Down key, but nothing was happening. Turned out to move between pages you can either hit the Space bar to move down a page, or the "+" and "-" keys to move back and forth in the document. Whereas with Acrobat you have to select a language version to install, Ghostview allows you to select between English, Italian, French and German. Of course this is an advantage for Acrobat if you need something other then these four languages, like Dutch, Spanish or Swedish, though the Chinese, Portuguese and Japanese versions available for windows are not available for OS/2.

An example postscript file viewed in Ghostview 2.8

Ghostview/Ghostscript is more then just a PDF viewer. You can view post script files and either convert them to PDF or extract the text from them to an ASCII text file. In addition you can convert to or read EPS files (Encapsulated Post Script). You can also select to print a document or pages as a bitmap using one of several bitmap versions (bmp16,bmp256, bmp16m).

### Creating a PDF Document

I next looked into creating a PDF from a postscript file. For starters I downloaded the latest Postscript printer driver for the HP 5P/6P from IBM's DDPakOnline site - ftp://ftp.software.ibm.com/ps/products/os2/os2ddpak/pscript.exe. Uncompressed that into a directory and then went into my Printers folder and dragged a new printer from the printer template. I selected to "Install new printer driver" then "Other OS/2 printer driver" then entered the directory for the new postscript driver. I selected the HP 6P from the list of available printers, then under output port checked of "Output to file".

Next I fired up Netscape Communicator for OS/2 and opened Thomas Gunzelmann's review of Papyrus in this month's issue of the newsletter. That seemed like a good choice since it has several images in it. I clicked on Print then selected the Postscript printer, checked the properties and selected 600DPI(choices were 300DPI or 600DPI) and then saved that. I then printed the html page to "papyrustest.ps" which created a 16,678,461 byte file in my netscape\program directory. That's one big file. Even taking into account that the graphics were a total of about 330,000 bytes, 16Meg was more then I had expected. I then opened that .ps file in Ghostview. It took about 29 seconds to open the first page.

It was opened as a 9 page document, with the HTML TITLE and the file path at the top of each page, and the page number and creation date and time at the bottom. I assume this was created by Netscape when printed. All formatting appeared to be preserved, though the text appeared a bit fuzzy, though completely readable. Changing to use a Text Alpha of 4 in Ghostview's "Media" "display options" didn't seem to help this a bit. This setting turns on anti-aliasing font rendering, which renders the document a little slower, but smoothes out the fuzzy edges of the text. There is a similar setting for images as well called the Graphics Alpha. Changing that made the text look great. When I checked Netscape I realized it was using the Times New Roman MT font which is a bitmap font. I changed that to Times Roman (Tms Rmn), then printed the same HTML page to a postscript file as before. The resulting .ps file was almost half the size of the first try (8,823,076 bytes). So using a vector font makes a big difference in file size when creating postscript files.

One difference I noticed between the original HTML and the postscript file was that the article title was olive in the HTML version, but gray in the postscript file. Then it dawned on me that the printer I selected was a black and white laser printer. Interesting that the graphic images were all in color, just the text wasn't. So then I went back into the printer driver install and looked for a color postscript printer. I selected the first one I found the Apple Color Laser printer. I then re-printed the postscipt file from Netscape using this new printer and all the text colors were exact. Even the HTML links were blue. unfortunately PDF doesn't support hyperlinks, so any links are for show only. One interesting thing is that the color output postscript file was slightly smaller then the original grey scale one, coming in at about 7Meg at the same 600DPI resolution. The resultant PDF of the full color version was also smaller at just about 1 Meg. In addition there were 10 pages total now, and instead of splitting images across pages it started the image on the next page. So the output may be dependent on which postscript driver you choose to create the input file.

Also interesting that I noted an error in the HTML layout of this page when I browsed the postscript version, that I had missed before. Also of note, one of the images crossed a page boundary so part of it was on one page and the rest on the next page. So if you want to convert an HTML page to postscript or PDF you have to take into account where the page boundaries are so images and paragraphs aren't split in an unexpected manner.

I then created a PDF, which took only about 30 seconds. To do this you select Print, then choose PDFWRITE as the printer, select print to file and choose a resolution. Resolution choices include 72DPI, 300DPI and 600DPI. Also select what pages you want to print. My first attempt resulted in only the current page being printed to a PDF file. The help suggests 300 DPI, saying 72DPI will result in very rough looking fonts. I selected 600DPI, and that created a 1,267,864 byte PDF file, using the postscript file from the Times Roman vector font. So the PDF file was about a seventh the size of the original postscript file.

Thinking that cutting down the resolution might shrink the size of the PDF file, I printed the same file selecting 300DPI. Boy was I surprised that the file size actually increased a tiny bit. Dropping it still further to 72DPI, decreased the resultant PDF file size by about 600 bytes. Even at 72DPI the file was readable with anti-aliasing enabled.

## Likes/Dislikes

Not much to dislike about ghostview. It's not quite as polished as the Acrobat for OS/2, but it seems faster and I have yet to find a PDF file I couldn't read with it, though I've only been using it for a few weeks now.

It would be nice if the install for Ghostview allowed you to change the system wide default association for PDF's from Acrobat to Ghostview. It does set up an object with associations to "*.PDF", "*.PS" and "*.EPS". Though even after I removed all associations from the Acrobat Reader Object properties, and added "Acrobat Document" and "*PDF" to the associations for the GSview object, but Acrobat remained the default application for all PDF documents on my system. I did successfully change the default for PDF documents by using the SETDEFV.CMD function available in any fixpaked Warp 4.

> C:\OS2>setdefv "GSview" temp.pdf

If you need to create a PDF document under OS/2, or read a postscript file, then this is your solution. Since PDF files don't seem to suport hyperlinks and just one article from the newsletter (albeit one with quite a few images) converted to PDF was over one meg in size, I don't think we'll be seeing the newsletter in PDF format anytime soon. But it's still nice to know there is an easy way to create PDF couments under OS/2.

Ghostview 2.8 - http://www.cs.wisc.edu/~ghost/gsview/get28.html
Ghostscript 6.0 - http://www.cs.wisc.edu/~ghost/aladdin/get600.html
Adobe PDF Viewer for Java - http://www.adobe.com/products/acrviewer/main.html
Adobe Acrobat Reader for OS/2 - http://www.adobe.com/products/acrobat/morethanreader.html

Features
editor@os2voice.org
[Previous Page ] [ Index] [Next Page ]
VOICE Home Page: http://www.os2voice.org