Reading PDF and PostScript Files -- Can the Amiga Become an Acrobat?

by

Michael Tobin, M.D., Ph.D.



The Setting

When I started my new position as Section Chief in Nuclear Medicine, I wanted to make sure that all our procedures were up to par. Nuclear Medicine is a branch of Radiology which uses small amounts of radio-isotopes mainly to diagnose, but occasionally to treat, disease.

I called the Society of Nuclear Medicine and was told that a series of guidelines had been developed for the performance and interpretation of many different types of patient examinations. These protocols were developed in response to physician's requests to have an agreed on "best way" of doing things according to the "experts."

The individual I contacted at the Society suggested that I visit their website and download whichever protocols I needed.

As soon as I saw the .pdf extension on the files, I knew I was in trouble.

Adobe PDF (Portable Document Format)

Adobe PDF file format is one of several formats that allows a document containing text, tables, and images to be saved in a single file that can be read exactly as it was created by anyone with the appropriate software.

Creating the PDF file requires purchase of one of the Adobe software packages. The Adobe Acrobat Reader, on the other hand, is free. Unfortunately, the Amiga is not one of the computer platforms for which a Reader is available.

What's an Amiga User to Do?

Although I could have tried to use one of the MacIntosh or PC emulators, I felt that I wanted to give the Amiga a chance on its own.

So I searched Aminet Aminet for a PDF reader. I came up with xPDF and Ghostscript programs. As it turned out, being able to read and print a PDF file took much more than a 2 minute installation and a quick glance at the documentation.

Eventually I was able to read print and save PDF files. My experience taught me much about PDF, PostScript, and Amiga programs in general. I would like to share that experience with you. PDF files are not uncommon and you may find yourself faced with the same problem.

An Overview

Basically, I am going to describe two approaches to the problem.

The first uses xPDF which can read PDF files but saves them as PostScript files. PostScript files can be printed on PostScript printers or be read, printed, and saved by shareware interpreters like Post or previously available commercial products, like SaxonScript.

The second approach uses Ghostscript, which alleges to be able to interpret PDF files directly.

I'll tell you what you need to do to use each approach. I'll also tell you which approach I prefer and why. I will conclude with a little sermonizing about the little computer that can -- the Amiga.

xPDF

To use the XPDF approach, your first step would be to download xpdf2c.lha from Aminet (http://www.usa.aminet.org/aminetbin/find/) or one of its mirror websites. This X11 program, ported to the Amiga by Terje Pedersen, allows you to read Adobe Acrobat Portable Document Format (PDF) files. Before you can, however, there are a few things you must do.

Because xPDF uses Terje's own x11 library, you must first assign the libx11 file that comes with the program. So, if you place the xPDF directory in your Work: partition, your assigns would look like

  • assign libx11:   Work:xPDF/libx11

  • path xPDF:       Work:xPDF add

Actually, libx11 is a directory that contains two ASCII files. The first of these is AmigaDefaults, which looks like a preferences file, and rgb.txt, which assigns descriptive names, like CadetBlue and ForestGreen, to different RGB values.

You probably won't want to change rgb.txt, but have a look at AmigaDefaults. The meaning of the file is obvious once you see it. After you get used to xPDF, you may want, for example, to change some of the font assignments.

How do you use xPDF?

xPDF is a CLI program. So, if you keep your PDF files in a directory called PDFfiles on the Work: partition of your hard drive, you would open up a shell and type:

  • stack  20000    (Unix programs love s p a c e )

  • xPDF   Work:PDFfiles/file.pdf  [return]

The results are shown in FIGURE 1. Here we see the PDF document displayed in a window with rather obvious controls on the bottom. Although one can scroll up and down the window, text updates are slow and change in a jerky fashion. The text is readable, but hardly elegant.

Printing out the document would be desirable, given the unpleasantness of reading the text on-screen. Although the printer icon at the bottom of the window would appear to offer this option, it does not. Rather, it converts the PDF file to a PostScript file and leaves the rest up to you.

Before moving on to the issue of what to do with PostScript files, you can use your favorite file utility to note that a PostScript file is approximately 5 times larger than the PDF file from which it came.

You Do Have a PostScript Printer, Don't You?

Well, you are home free if you have a PostScript printer. If you do not, you will need a PostScript interpreter to translate the PostScript page description into a bitmap image your printer can understand. Hmm.... Have we only exchanged one problem, printing a PDF file, for a new problem, printing a PostScript file?

Well, we do have options. We have the Aminet programs POST and its successors, a variety of Ghostscript versions, and vintage (and alas, no longer so readily available) commercial offerings like SaxonScript.

An Overview of POST

All flavors of POST, and PostScript interpreter programs in general, have certain features in common.

The first is the ASCII init.ps file which contains boring but necessary information about fonts, where to find them, the default font, and much more that is only understandable to those conversant with the PostScript language. The aim, we read in the documentation, is to mimic a PostScript printer.

Next is a library, which for POST is the post.library Typically, there is a plain vanilla version of the library for 68000 processors and another for those with 68020 acceleration. You put your choice in libs: directory.

Then, you need fonts. PostScript fonts, that is, and not the garden variety bitmap fonts that come with the Amiga. Your sources will be Adobe (tm) Type Manager and Plus Pack (Type 1 fonts) or what you find in the public domain (Type 3 fonts). Have no fear. Much of what you will need is on Aminet.

Finally, comes the POST program, which is either run from the CLI or from the WorkBench via a GUI.

Doc files, small PostScript related programs, and example PostScript files for you to play with, round out the typical POST archive.

All POST programs like you to write an assign statement in your user-startup file for POST and for PSFonts, your PostScript font directory.

POST, Enhanced POST, HWGPOST, and POSTV2

POST v1.7B (POST17B.lzh) is the grand daddy POST program, copyrighted in 1989 and 1992 by Adrian Aylward. It enabled the viewing, saving and printing of PostScript files.

An enhanced version, Post v1.86 (Post186enh_bin.lha) included, among other changes, a new post "front-end" while keeping the post.library and the init.ps file the same. Importantly, it contained a collection of usable public domain fonts.

HWGPost (HWGPOSTbeta11.lha), according to the author, Heinz Wrobel, had, as its major contribution, a significant re-write of the post.library. He described his interface to the library as "A hacked up post 1.7 front-end to try out HWGPOST" and recommended that the original Post viewer or PostView (PostView1.2.lha) be used instead. He also provided an incredibly useful PostScript datatype enabling all datatype- aware programs, e.g., multiview, to view PostScript and encapsulated PostScript files.

Post V2 (POSTV2.lha) is a new viewer by Christian Eibl, which utilizes the HWG post.library or one of the older post libraries. As such, it demands the installation and understanding of HWGPost or one of its predecessors. It can be run from workbench, the CLI, or via AREXX and is highly configurable.

The most up-to-date configuration of Post would then be the post.library and init.ps from HWGPost, the viewer from Post V2, and the fonts from Post V1.85enh (Post186enh_bin.lha) and PSFonts (PSFonts.lha), unless you provide your own. This is the configuration I will now describe in more detail.

The family of Post programs can be found on Aminet.

HWG POST -- What's in the Package?

The first step is to get HWGPost up and running. Fortunately, HWGPost comes with rather good documentation in AmigaGuide format. Read the "Contents" section first.

Init.ps, post.library, and the HWGPost viewer are files you already know to expect. In due course, you will be replacing the HWGPost viewer with the newer Post V2 frontend, but that will be later.

MathSingFix is a program that you will put as the first entry in your user-startup file to patch the mathieeesingbas.library. (New versions of setpatch from Amiga International may obviate the need).

HWGPOSTResources is a file which lists available PostScript fonts. You will replace this list with your own once you set up HWGPOST. The (included) program that does this is called enumfonts.ps. HWGPOSTResources stays in your HWGPOST directory.

PATH_FONT is the definition file for the font search path of HWGPOST. You will create a directory in ENVARC: (and ENV:) called, unsurprisingly, HWGPOST and put PATH_FONT in it. PATH_FONT required no modification from me.

PRTPS, which goes into your devs/dosdrivers directory, and prtpost- handler, which goes into your l/ directory are what HWGPOST needs for printing.

As I have already mentioned, HWGPost gives you a PostScript datatype for viewing PostScript and encapsulated PostScript files so you must also expect some entries in your classes and devs directories.

Once you install this datatype, you will be amazed how useful it is FIGURE 2. I have also found the HWGPost PostScript datatype to be more reliable than that provided by PostScriptDT.lha, which can also be found on Aminet.

What HWGPost Asks of You

I have already mentioned that unless you have some other source of PostScript fonts, you need to go to Aminet and get them from PSFonts.lha and from Post186enh_bin.lha and put them in a directory called PSFonts.

Next, you must assign POST and PSFonts appropriately. For me, the assigns looked like:

  • assign POST:           Work:DTP/PostV2

  • assign PSFonts:        WorkBench:PSFonts

  • path Work:DTP/PostV2   add

MathSingFix (unless new versions of setpatch make this unnecessary) belongs as the first line in your user-startup file while PATH_FONT belongs in the HWGPOST directory you create in ENVARC: and ENV:

While we are on the subject of ENVARC:HWGPost, you need to create a DATATYPECONFIG file if you want to see color rather than black and white with the HWG PostScript datatype. You place DATATYPECONFIG in ENVARC:HWGPost. The "Special Notes" section of HWGPost.guide tells you what to do. Because I accepted defaults for everything else, my DATATYPECONFIG file looks like

  • COLORS=3

  • BPC=8

where COLORS=3 means RGB and BPC=8 means 8 bits per color (256 total), which makes sense only for AGA graphics machines or those with graphics cards.

Additional easy-to-follow installation instructions are included in the HWGPost documentation.

Using Post V2 Viewer with the HWG post.library

Although it is tempting to want to use the HWGPost distribution as it is, I found that the HWG viewer had problems especially when it came to saving files and now have no need at this point for this admittedly unfinished product.

If you do wish to try HWGPost, there is a program called fixpost.lha, written by Cyborg@Trashcan.mcnet.de, which "will correct the iff-header generated by post from HWGPost-archive." The format of the command is

  • fixpost >tiger.new  tiger.original

Black and white graphics now seem all right but, due to HWGPost, color files still come out incorrect.

PostView, although recommended by Mr. Wrobel and friendlier to use than HWGPost, consistently crashed my A1200 when requested to save a file.

Therefore, I would suggest that after setting up the various files, etc., that you replace HWGPost viewer with the Post V2 viewer and add the Post V2 envarc files to ENVARC: and ENV:.

The Big Test

I tested viewing, saving, and printing PostScript files using the Post V2 viewer/HWGPost post.library combination. My test examples were the ubiquitous tiger.ps image file FIGURE 3 and several multi-page Nuclear Medicine guidelines in PostScript format derived from their PDF equivalents. These, you will recall, I obtained from the Society of Nuclear Medicine's web page.

Regardless of file content, the latest Post viewer/library combo is a pleasure to use. Unlike PDF files with xPDF, scrolling and reading PostScript files is smooth and pleasant even on AGA screens. For viewing text, I used an 800 x 876 productivity screen with 90 dpi. At 75 dpi, letters looked squashed.

Printing with Post V2 does require fiddling with dpi's, offsets, and pixel widths of pages, especially the first time. Actually, the HWGPost viewer seemed better in that it figured out the numbers for you. I didn't get too upset about this. PostScript files are saved as iff images and once saved, can be printed by any software you like. Saving PostScript files with Post V2 is effortless.

Post Downside?

The only major problem I encountered really had nothing to do with Post or its libraries. I found that PostScript files that contain text, such as the Nuclear Medicine guidelines, would not print because of a problem with the Symbol font that came with Post186enh_bin.lha. The author, Mr. Heinz Wrobel, e-mailed me a temporary fix for the problem which essentially was Symbol Encoding information that I inserted into the init.ps file that I currently use and which I store on my web site. [no longer available]

You can reach Mr. Wrobel by e-mail at heinz@hwg.muc.de should you encounter a similar problem. At this point, you should probably recall that both HWGPost and Post V2 are giftware and deserving of your consideration.

An Introduction To The Ghostly World Ghostscript

A totally different approach to reading PostScript files is Ghostscript. Perhaps I should use the plural Ghostscripts because there have been several versions of the Unix program Ghostscript that have been made to run on an Amiga. The copyright to Ghostscript is held by Aladdin Enterprises. Many enthusiasts have been involved in bringing Ghostscript to the Amiga including Olaf Barthel, Steffen Opel, L. Peter Deutsch, Markus Landgraf, Andreas Heitmann, Joop van de Wege, and probably others to whom I must apologize for failing to identify.

The most recent Ghostscripts claim not only to be able to handle PostScript but also PDF files. The ability to read, store, and print PDF files seamlessly without an intermediate conversion step is desirable. Combine this with the main executable being optimized for your specific Amiga processor and you have a program with a great deal of promise.

Ghostscript is constantly being updated. As I was finishing this article, a new version of Amiga Ghostscript, 5.01, appeared on Aminet. So don't be surprised if there is an even newer version of Ghostscript by the time you read this article. The changes, which you can read about in Ghostscript's doc/current.txt file, tend to be internal to the program, enhancing its capabilities, while the Amiga options tend to stay, more or less, the same.

There is an additional point to be made before getting down to the nitty-gritty of Ghostscript. Unix derived software tends to be case sensitive, and Ghostscript is no exception. AMIGA is not the same as amiga.

Ghostscript -- How she is installed

Installing Amiga Ghostscript is straight forward. The Ghostscript distribution comes with fonts, documentation, a series of small programs, including a crucial init file, example PostScript files, and a main executable file which you choose according to the Motorola processor you have.

You then modify your user-startup to assign Ghostscript: For example,

  • assign Ghostscript:     Work:Ghostscript

  • path Ghostscript:  add

Ghostscript will then search for its fonts in Ghostscript/fonts and its various files, including gs_init.ps, in Ghostscript/data.

Ghostscript -- How she is supposed to work

Using Amiga Ghostscript should also be straight forward. The general format is

  • gs -sDEVICE myfile.ps

-sDEVICE is the initial output device. For viewing, your choices might include amiga_high, amiga_low, amiga_custom (brings up a requester allowing you to choose your screen), amiga_picassoii, retina16, etc. depending on the Amiga implementation of Ghostscript. For Amiga Ghostscript 5.01, the choices are amiga, for viewing your PDF or PostScript file in a window on workbench and amiga_custom, for viewing on a custom screen with a screentype of your choosing.

Saving and printing work similarly, except that for saving, you need to specify a location and a name for the output file.

To see how this would work in practice, if one had a PostScript file, tiger.ps, one should be able to

View it with --
gs -sDEVICE=amiga_custom   tiger.ps
Save it with --
gs -sDEVICE=amiga_ilbm  -OutputFile=ram:pic.iff   tiger.ps
Print it with --
gs -sDEVICE=amiga_printer  tiger.ps

Using Ghostscript 5.01, I was able to view my favorite tiger with

  • stack 65000

  • cd gs:

  • gs -sDEVICE=amiga_custom

  • gs>(examples/tiger.ps) run

>>showpage, press <return> to continue>> [Ghostscript generated]

  • gs>quit

The first line is crucial -- Amiga Ghostscript 5.01 will crash without an error message if the stack size is too small.

You can find Amiga Ghostscript(s) on Aminet. Your best source of Amiga specific information, short of asking questions in Amiga newsgroups on the Internet, may come from the descriptive information you find next to the files themselves. So, don't forget to download the descriptive files.

Once you are inside the Ghostscript distribution, you can get more information from the use.doc file. The new-user.txt is also useful. Both of these are in the doc directory.

The Reality of Amiga Ghostscript(s)

Initially, I had tons of trouble with Ghostscript. Crashes without error messages were the norm. Finally, I posted a message to the comp.sys.amiga.misc newsgroup asking for people's experience with Ghostscript. Tony Philipsson responded in detail, suggesting a stack size of 65000 when running Ghostscript. Jeroen T. Vermeulen suggested using even a larger stack size, e.g. 100000, if the crashes continue.

Now that I use a large stack size (65000 has seemed sufficient), I have been able to view, save, and print PDF as well as PostScript files. Multi-page files are no problem. You can easily view them in a window on Workbench FIGURE 4.

Printouts of the tiger PostScript file on my Canon BJ-200e black and white printer were fine. Occasionally, when printing text, I would get a vertical line in the last column on the right for the initial few rows. Interestingly, in the documentation for Amiga Ghostscript 5.01 on Aminet, Joop van de Wege mentioned a bug in the amiga_printer option, but I do not know if my artefact is a manifestation of it.

Even with this artefact, print quality of PDF and PostScript text files was more than adequate for reading. You can, however, improve the appearance by using the "r" switch in the initial command line when calling the Ghostscript program FIGURE 5. For my Canon printer, which is configured for epson emulation, I use --

  • gs   -r110x200   -sDEVICE=amiga_printer

Ghostscript and You

Once you know about the stack size requirement, I think that you will find Ghostscript quite serviceable.

Color PostScript files, such as tiger.ps, get saved as grey scale images when using -sDEVICE=amiga_ilbm. However, you can get around this by saving the image as a 256 color BMP file as in --

  • gs -sDEVICE=bmp256 -sOutputFile=Ram:tiger.iff   tiger.ps

When displaying PostScript files, Tony Philipsson had some further advice which I thought I would pass on. In reference to Ghostscript 4.03 he said, "Do not move the window sliders until page is fully drawn. The program is buggy and will lock-up."

The Angle on SaxonScript

SaxonScript Professional is a commercial PostScript interpreter which, unfortunately, is no longer available. It was copyrighted by Emerald Graphics Corporation, Canada, in 1992.

I tested SaxonScript on my Amiga 1200, with Amiga OS 3.0, 18 MB of RAM, a 775 MB IDE hard drive, a 68030 DKB accelerator with a SCSI connector, and numerous SCSI devices chained together. Such a system was unheard of when SaxonScript was developed. And yet, this program, which was designed to run on Workbench 1.3, two floppy drives and 1 MB of RAM worked exceptionally well.

Installing and Using SaxonScript

Installing the SaxonScript program seems strange now in that it does not come with an Amiga installer utility. Rather, one creates a directory, drags drawers into it, and installs the various parts of the program by opening the drawers and double clicking the install button there. There is an advantage to this. Because the different drawers can be scattered according to hard drive space, SaxonScript is totally modular FIGURE 6.

Basically, SaxonScript gives you a psc: device to which you can send PostScript files for (pre)viewing and printing. The print quality is excellent!

SaxonScript does even more. For example, it can save PostScript files in IFF-ILBM, EPS, AEPS, or DR2D formats. As a nice touch, the program allows you to crop an image before saving it.

SaxonScript also contains several utilities. With GetFont, you can convert MacIntosh and PC Type 1 fonts into Amiga Type 1 format. You can also use GetFont to convert PostScript Type 3 fonts into Type 1 fonts. This one utility is probably worth the price of the entire software package.

How About those Docs?

Because you will want to optimize program settings to take advantage of the extra RAM that many of us now have, it is important that the documentation be adequate. SaxonScript's documentation is more than just adequate. It is fantastic.

SaxonScript not only describes all aspects of the program with clarity, but also includes within its 78 page manual a readable history of printing from Johannes Gutenberg to the advent of compressed binary PostScript!

What's the Downside?

You will find that, because of SaxonScript's age, some of the discussions, especially about printers, is out of date. Also, SaxonScript only supports PostScript level 1 commands. I couldn't see or use the controls at the bottom of the preview or cropping screen until I booted my Amiga in PAL mode. You may find a better way.

Hmm...So What Should I Use?

If you have PostScript files AND you basically want to have excellent printed copies, try to get hold of SaxonScript. The GetFont utility alone is worth the effort.

For viewing PostScript images, you can take advantage of HWGPost's PostScript datatype with multiview or similar. For multi-page PostScript documents, Post V2 with the HWG post.library will allow you to view, print and save.

Once you know about the stack size requirement and if you don't mind using the CLI, I think you will find the latest versions of Ghostscript very acceptable. If you have PDF files, Amiga GhostScript does a very nice job of displaying and printing without needing first to convert to PostScript. If your files are already in PostScript, Amiga GhostScript will still work nicely.

Both Ghostscript and Post seem to have rather frequent additions and upgrades. But a new version does not necessarily mean a better version. It is possible, for example, for a bug to be introduced inadvertently or for a feature you liked to be omitted. So don't throw away the old versions until you can test the new ones. On the other hand, if you are just starting out and having problems with the latest version, don't hesitate to try an earlier version. These same recommendations could apply to any program, not just the ones discussed in this article.

Related Issues

Although I haven't covered the topic of dealing with non-Amiga wordprocessor formats, it does seem relevant. The usual scenario revolves around the need to transfer written documents between an Amiga friendly home and a hostile PC world. The key is to save your documents at work in RTF (Rich Text Format) and have an Amiga program, such as Final Writer (Softwood, Inc.), import the text. Make whatever changes you want and then save back in RTF.

One last way of importing text into the Amiga is to use a flatbed scanner to scan a printed page into it. The printed page will be an IFF graphic file. The fact that the "picture" is made up of letters is initially irrelevant. However, a program called OCR by Migraph, Inc., can, via optical character recognition, translate the graphic file into ASCII text. The program works flawlessly under OS3.0 and 3.1. Unfortunately, like SaxonScript, OCR is no longer commercially available.

Did I Leave Anything Out?

You bet! Like what? Like lots. Did you know that Provector 3.0 (Stylus, Inc.) allows you to import PostScript files via its PSImport module? Do you remember the PostScript interpreter program called PixelScript by Pixelations?

You can never really finish talking about PostScript, or its larger topic, desktop publishing. The best one can hope for is to find a convenient stopping point.

What About a Wish List?

Of course I have a wish list. Some of the wishes are probably in the realm of fantasy, like Emerald Graphics coming back and working on a new version of SaxonScript. Others, like an existing Amiga developer taking over the rights to SaxonScript and bringing it up to date, may be more realistic. Naturally, I would want the next version of SaxonScript to be able to handle the latest PDF and PostScript formats, fit the preview screens better, and update and expand the excellent documentation. Perhaps Saxon Publisher could also be revived or some features incorporated in a new program.

For Post, I would hope that the HWG post.library would be developed further and also be able to handle PDF files. I would like the Post V2 frontend bundled with the HWG post.library and an Amiga Installer handle all the installation details. I'd also like to see a problem-free set of PostScript fonts included in the Post archive so that no special "fix" would be needed, as for the Symbol font.

For Ghostscript, I would like more user transparency and friendliness. I'd like to see an easy to use Amiga interface. I'd want error messages instead of crashes. I'd like some decent Amiga oriented documentation.

So What to Make of All This?

Clearly, I am now able to use the Amiga to read and print the Nuclear Medicine documentation I need even though it is in PDF format. Having taken the time to figure everything out, the process is now smooth and effortless. And now that I have shared my experiences with you, hopefully you will be able to avoid some of the blind paths I initially stumbled along.

And the Amiga?

Through all its difficult times, the Amiga has remained an extremely powerful, user-friendly computer platform. But the Amiga needs more than the best operating system. It also needs applications.

Post and Ghostscript clearly show what, over a period of time, dedicated Amiga shareware authors can produce. But, almost every author writes about the time constraints he is facing and how much he would like to do if he had the opportunity.

I don't see a conflict between shareware and commercial. The Amiga needs both. But I think that it is only through financially successful ventures that Amiga authors can earn enough to devote themselves full time to the development of new programs.

We, the Amiga users, can support software development by purchasing Amiga products. If developers can stay in business, then we can maintain our investment in Amiga platform.

Postscript(!)

I would like to thank Mr. Ed Lake of the Amiga Users Group of New York (Amuse) for helpful discussions regarding the PostScript language and for verifying the readability of several PostScript files when my initial attempts with Amiga programs suggested otherwise. I also thank him for recommending the small, but information-packed, Pocket Pal: A Graphic Arts Production Handbook by International Paper. Now in its 16th edition, it is an excellent source of information about almost anything having to do with printing.

February, 1998


List of Publications -->

Return To Home -->