Friday, January 06, 2006

 

Some notes on PS and EPS

1.
Internet Resources for POSTSCRIPT and GHOSTSCRIPT

By Jim Land
From http://www.geocities.com/SiliconValley/5682/postscript.html

ADOBE SYSTEMS
They invented PostScript over two decades ago. Their website features PostScript, Adobe fonts, all sorts of Adobe products (Illustrator, Photoshop, Acrobat, etc.),drivers, downloads, and a knowledgebase of information about Adobe products.
http://www.adobe.com/
ftp://ftp.adobe.com/

Ghostscript


GHOSTSCRIPT FAQ

What is Ghostscript? How can I view a PostScript file? How can I print it to a non-PostScript printer? Can I print just one page of a PS document? How can I print all the odd-numbered pages of a PS document? What's the difference between "AFPL" and "GNU"? etc.
http://www.cs.wisc.edu/~ghost/doc/faq.htm

GHOSTSCRIPT MANUAL
Thomas Merz's 24 page manual covers many aspects of Ghostscript, including installation, configuration, build process, applications, and troubleshooting. Auch auf Deutsch.
http://www.cs.wisc.edu/~ghost/doc/merz.htm

GHOSTSCRIPT PRINTER COMPATIBILITY
"Which driver should I use for my {brand} {model} printer?"
"Of the printers on the market, which are compatible with Ghostscript?"
http://www.cs.wisc.edu/~ghost/doc/printer.htm
The Printing Howto web pages have loads of technical information, including how-to-print-from-Ghostscript, for just about every printer, from Alps to Xerox.
http://www.linuxprinting.org/database.html

DOWNLOAD GHOSTSCRIPT, GSVIEW, GHOSTVIEW

Go to the Ghostscript home page.
Follow the link "Obtaining AFPL Ghostscript".
Find your operating system.
Read which files you need.

You can download them from the links on that page. Or you can get them by ftp at ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/
or in a similar directory at a CTAN mirror site worldwide.
For Windows 95, 98, NT, 2000 and XP: Download and install both Ghostscript and GSView.

GV
GV is an alternative user-interface for Ghostscript, similar to Ghostview. Source code, you compile (Unix, VMS)
ftp://ftpthep.physik.uni-mainz.de/pub/gv/

MGV
MGV is a Motif interface for Ghostscript. Source code, binaries (Unix)
http://www.pa.msu.edu/reference/mgv-doc/mgv.html

GoBatchGS
GoBatchGS is a batch-processing GUI front-end for GhostScript. Select PS and PDF files for conversion to JPEG, PNG, TIFF, PDF, EPS, WMF, DXF, PCL, RTL. Merge PS and PDF files into one PDF. (MS Win)
http://www.noliturbare.com/ReadGoBatchGS.htm

AFPL GHOSTSCRIPT and GSVIEW questions: Support Forums at SourceForge Newsgroup
comp.lang.postscript

GHOSTSCRIPT and GHOSTVIEW Development Site
http://www.ghostscript.com/

GHOSTSCRIPT Licensing:If you want to embed Ghostscript in your commercial software
http://www.artifex.com/


Drawing

DRAW A PICTURE
Mayura Draw is a drawing program for creating and editing PS, EPS, AI, and WMF illustrations. Point-and-click to choose line width and color; draw rectangles, ellipses, polygons, and bezier curves; insert bitmaps and text; move, rotate, reflect, and skew. Exports to EPS, PS, AI, PDF, WMF, BMP, TIF, GIF, JPEG, and SVG formats. Formerly named PageDraw. (MSWindows) Shareware: Free download, (US Dollars) $25 to register.
http://www.mayura.com

The GIMP is the impressively versatile GNU Image Manipulation Program, able to create, edit, and convert images in a variety of formats, including PS and EPS. (Unix/X11, OS/2, Win95/NT)
http://www.gimp.org

Many other graphics programs are available for Unix/Linux platforms.
http://vectorgraphics.sourceforge.net/editors.php

METAPOST is a programming language for creating PS technical illustrations (graphs, curves, diagrams) with graphics and text. (Unix, OS/2, Win95/NT, DOS, Mac)
http://www.tug.org/metapost.html

PSTRICKS is a (La)TeX package which allows you to use the major part of PostScript capabilities inside (La)TeX.
http://www.tug.org/applications/PSTricks/


Printing

N-UP PRINTING and WATERMARKS in MSWin and Mac
Want to shrink 2, 4, 9, or 16 PS document pages onto one side of one sheet of printer paper? Or place a big message ("watermark") in the background of each page? It's easy in Windows and Mac. If you don't already have the Adobe PostScript Driver, just download and install it. (Not the driver for a PS printer, but the latest Adobe PostScript Driver.)

Windows Adobe PostScript Driver, PPD files
http://www.adobe.com/prodindex/printerdrivers/windows.html

Macintosh Adobe PostScript Driver, PPD files
http://www.adobe.com/prodindex/printerdrivers/macintosh.html

PRINTFILE
Send a file to a printer (even a network printer). Select which pages to print, including odd- or even-numbered pages. Offers drag-and-drop, n-up, and eps printing; on-the-fly file conversion (for example, by Ghostscript), automatic prepend of a printer prolog, and a "watched folder" function. When you use Printfile to print a PS file, it can automate Ghostscipt's conversion for a non-PS printer. (MSWindows and DOS)
http://www.lerup.com/printfile and at many shareware sites worldwide.
IMPRINT has similar features. (MSWindows) Free demo (US Dollars) $30
http://www.gallicrow.co.uk/Imprint.html
Microsoft Knowledge Base article 158081 explains how to print a file from a command line and how to enable drag-and-drop printing in Win95-98.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q158081
DROP PS sends a PS file to any AppleTalk-connected PostScript printer. (Mac)
http://www.barebones.com/products/freeware.html

REDMON: Non-PS printers print PS
Set up Redmon on a printer port, and when any application prints to that port, Redmon redirects all the data to a program for processing before sending it on to a printer. Works with network printers, too. Used with Ghostscript, any non-PS printer becomes a virtual PS printer. Or set up Redmon with a PS printer driver and Ghostscript to create PDF files ("PDF Writer"). (MSWin) (Site contains links for similar utilities for OS/2 and Unix.)
http://www.cs.wisc.edu/~ghost/redmon/


MAKE A POSTER Enlarge an EPS (or single-page PS) picture to any size. If your printer isn't big enough to print it, you can "tile" it by printing out lots of smaller pages which you glue together. (Unix and DOS)
Poster
If you do this commercially, you might be interested in PosterShop.

PSUTILS
A useful set of utilities for printing PS documents, including
psresize -- Alters document paper size
psselect -- Selects pages and page ranges
pstops -- Performs general page rearrangement and selection
psnup --Prints multiple document pages per physical sheet of paper
psbook -- Rearranges pages into "signatures"
epsffit -- Fits an EPSF file to a given bounding box

Home Page:
http://knackered.knackered.org/angus/psutils/
Windows95/NT and Source code and documentation:
http://gnuwin32.sourceforge.net/packages/psutils.htm
OS/2:
http://www.tex.ac.uk/tex-archive/systems/os2/psutils.zip
or in a similar directory at a CTAN mirror site worldwide.


PPST: PS PROCESSING SPEED TEST
Send a series of complex PS files to your printer or interpreter to see how fast it can process them.
http://www.gaaj.com/ppst/


See this caution about the results of PPST
PS Utilities Package, PSUP tests your printer's resolution, halftoning, etc.
http://www.gaaj.com/psup/

ISO Paper Sizes has everything you always wanted to know about the metric paper size system (A4, etc.), but didn't know where to look
http://www.cl.cam.ac.uk/~mgk25/iso-paper.html


PRINT-TO-FILE FAQ
How to redirect output to a file, instead of a printer. (Win95)
http://www.gallicrow.co.uk/PrintingFAQ.html


POSTSCRIPT ERROR MESSAGE FAQ
Is your PS printer or interpreter sending you cryptic error messages? Look them up here for explanations. (Also HP LaserJet error codes)
http://ds.dial.pipex.com/quite/errors.htm

or visit the PS Error Database
http://www.prepressure.com/ps/dbase/overviewerrors.htm
or consult the Troubleshooting page
http://www.prepressure.com/ps/trouble/troubleshooting.htm

FIX YOUR OWN LASER PRINTER
Are you the Do-It-Yourself type? Here are error codes, troubleshooting guides, and parts.
http://www.fixyourownprinter.com

PRINTER QUESTIONS
Newsgroup comp.periphs.printers


Font Types

ADOBE FONT LIBRARY
Browse or search hundreds of PostScript fonts, view samples for free. (The fonts themselves are available for a price.)
http://www.adobe.com/type/

EURO SYMBOL
The official Euro currency symbol: sans-serif, monospaced, serif, italic, bold. Download for free.
http://www.adobe.com/type/eurofont.html


MYFONTS
Central source for commercial fonts from nearly 200 foundries. Browse, search, buy, download.
http://www.myfonts.com/

SCRIPTORIUM FONTS
A large collection of imaginative, elegant fonts based on the decorative typography of a century or more ago. Prices are quite reasonable (as low as 8 fonts for (USDollars) $18) and new fonts can be downloaded as shareware. (When ordering, specify which OS you're using — PC, Mac, OS/2, etc. AFM files are included when requested.)
http://www.fontcraft.com/scriptorium/index.html


Ghostscript comes with 35 quality PS fonts (all the "standard" fonts, although with different names).
WHAT FONT IS THAT?
See a font you like? Want to know its name? Upload a brief sample of it and this search engine will display closest matches from its font database.
http://www.myfonts.com/WhatTheFont/

Or identify a font by answering a series of clever questions.
http://www.identifont.com/

FONTSHEETS prints a sample of every PS font in your printer, in a compact format sorted by font family.
http://www.glyphic.com/free/fontsheets.html

Johan Vromans' utilities extract information and metrics from PS font files, print sample pages, and convert between PFA and PFB.

Dylan McNamee's handy Font Viewer shows every character and glyph in the font, even those not in the encoding vector.

FONTFORGE (formerly PfaEdit) lets you create and edit fonts in PS, TrueType, and other formats, and convert between formats (including PC and Mac). (Unix; MSWin requires CygWin) t1utils convert PFA to and from PFB, convert PFA and PFB to and from readable/editable format, and convert PFA and PFB to and from Mac format. Multiple master tools mmafm & mmpfb can create an instance or a normal, single-master font. LCDF Typetools deal with Compact Font Format (CFF) fonts, or PostScript-flavored OpenType fonts.

Nelson Beebe's Notes on Fonts has lots of information about PS font files, utilities, and sources — including free fonts on the web.

Luc Devroye is a computer scientist and font maven. His web site has hundreds of links to fonts (including freeware and shareware), font software, typography, and PS/PDF.
Thomas W. Phinney discusses the technical and practical differences between PostScript Type 1 and TrueType fonts, including information on Multiple Master Fonts, OpenType, Unicode, and GX and AAT fonts. (PDF file)

BarCode 1 has everything for barcodes.

Barcode fonts are also available here and here.

BarCodeWriter is a PS program which encodes and renders barcodes in many different formats.
Andy Burns's Gauge 88 is used around the world to visually gauge the size of type fonts. It's written in PS--just print it on clear film.

FONTS FAQ
From the newsgroup comp.fonts
http://www.faqs.org/faqs/fonts-faq/

FONT QUESTIONS
Newsgroup comp.fonts


EPS

EPS FAQ
What is EPS? Can I print it? How can I make it? What about OPI and DCS?
http://ds.dial.pipex.com/quite/eps1.htm

Importing EPS into MS Word
Help for importing EPS illustrations into a Word document is available here.

PS to EPS
How to convert a one-page PS file to EPS, using only a text editor
PS to EPS

EPSMERGE and EPSSPLIT
Merge multiple EPS graphics into one EPS graphic, or split one EPS into smaller pieces. (Unix; requires Perl to run)
http://web.mit.edu/afs/sipb/contrib/postscript/src/epsmerge-1.2.1/
http://home.clara.net/nox/software/epssplit/epssplit.html

EPStool
Create or extract preview images in EPS files, fix bounding boxes and convert to bitmaps.
http://www.cs.wisc.edu/~ghost/gsview/epstool.htm


Programming

PostScript can do more — much more — than describe where to put ink on paper.
It's also a programming language, with variables, arrays, conditionals, and a stack.
Not to mention superb vector graphics and fonts.
PostScript has been called "an unappreciated yet superb general purpose computing language".

You can write a PostScript program using any text editor. Here's the familiar "Hello World" program in PostScript:

%!PS
/inch {72 mul} def
/Times-Roman findfont 50 scalefont setfont
2.5 inch 5 inch moveto
(Hello, World!) show
showpage

To run a program, all you need is a PostScript interpreter such as Ghostscript.

Tutorials
Want to write your own PS programs? Learn the basics for free, right here on the web:

A First Guide to PostScript by P.J. Weingartner (Univ. of Indiana)
A nicely written ten-chapter primer, now in its third edition.
http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html

PostScript Tutorial by Paul Bourke (Swinburne Univ.)
A one-page introduction to PS programming.
http://astronomy.swin.edu.au/~pbourke/geomformats/postscript/

PostScript Programming Tutorials (Interface Technologies Inc.)
Short, concentrated tutorials that get you going real quick. (Free registration required.)
http://devcentral.iftech.com/articles/Other/default.php

Tom Greer's Articles contain an introduction to elementary PS programming, including how to cache PS content you want to re-use, and how to merge data with a PDF form.
http://www.tgreer.com/resources.php

Practical PostScript by David Byram-Wigfield
An introduction to using PostScript to display and format text, including columns, line-wrap, justification, footnotes, and fonts. Typeset your own book for printing or distilling to PDF. (PDF, 92 pages)
http://www.cappella.demon.co.uk/bookpdfs/pracpost.pdf

A Manual for Mathematical PostScript by Bill Casselman (Univ. of British Columbia)
Part 1 is an introduction to PostScript programming, including curves, recursion, and non-linear transformations.
Part 2 includes 3-dimensional drawing, surfaces, motion, and polyhedra.
http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/index.html

PostScript Programs
Dylan McNamee's webpage has some PS toys that are both fun and useful. If you want to see some handcrafted PS code, check these out: a calendar maker, a very handy font viewer (shows every character and glyph in the font, even those not in the encoding vector), a utility for plotting graphs, a quicksort routine, and a program for adding a big watermark to any document background.
Gernot Hoffmann has lots of PS programs for graphing sine, gamma, Bezier, and other curves, as well as chromaticity diagrams and 3-D plots.
John Deubert has a PostScript and Acrobat Resources page with lots of code samples.
Graham Freeman has written PS programs for typesetting, drawing family trees, and producing color separations.
Jamie Zawinski's PS programs print labels for audio, DAT, 8mm, and VHS cassettes, CDs and their cases. Cameron Morland has PS programs that generate fractals and Karnaugh maps.
Evan Danaher has written John Conway's Game of Life in PS.
Maurizio Loreti has PS programs for printing calendars in English and Italian.
Oskar Schirmer has written programs for producing a polyhedron calendar and for computing the date of Easter Sunday.
Peter Billam has subroutines for drawing in PS, a Perl program for typesetting music in PS, and compares the PS and Perl programming languages.
Frank Siegert's PS program calculates pi to over a quarter-million decimal places.
Anders Karlsson has written a web server in PostScript!
The comp.sources.postscript newsgroup has been defunct for some time, but the archives contain a variety of hand-coded PS programs.
If you want to see what the source code for a PostScript interpreter looks like, take a look at Ghostscript or ROPS


Using PostScript with Other Programming Languages

FORTRAN
PSPLOT is a library of Fortran-callable subroutines for creating PostScript graphics files.
http://www.nova.edu/ocean/psplot.html

C
CGRAPH lets you create PostScript graphics files from your C program.
http://neurovision.berkeley.edu/software/A_Cgraph.html
GNU PLOTUTILS has similar capabilities. (Unix)
http://www.gnu.org/software/plotutils/plotutils.html

JAVA
Marco Schmidt's web page has links to Java resources for creating and rendering PS and PDF documents.
http://www.geocities.com/marcoschmidt.geo/java-libraries-postscript.html

PYTHON
Python PS is a Python module for creating PS documents.
http://www.pugo.org/pyps/

PERL
PostScript::Simple lets you create and print PS documents from Perl
http://cpan.uwinnipeg.ca/module/PostScript::Simple or your local CPAN mirror

LISP
PLISP is a compiler that generates PS from Lisp.
http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/io/plisp/0.html

MANY PROGRAMMING LANGUAGES
PGPLOT plots PS from C, C++, Fortran, Perl, Python, and other programming languages.
http://astro.caltech.edu/~tjp/pgplot/

POSTSCRIPT LANGUAGE REFERENCE ONLINE
If you don't have a copy of the Red Book handy, look here:
http://mdwconsulting.mdwserver.net/postscript/postscript-operators/
http://www.capcode.de/help/
http://atrey.karlin.mff.cuni.cz/~milanek/PostScript/Reference/

Classes
John Deubert: PS and PDF, beginner to advanced, half day to 5 days.
http://www.acumentraining.com/
Tom Greer: Personalized PS training
http://www.tgreer.com/

Newsletter

John Deubert's Acumen Journal is a free monthly technical newsletter with information on programming PostScript and using Acrobat. Topics have included "Adding Characters to a Type 1 Font", "Reencoding Fonts", and "Concatenating PostScript Files". Current and past issues are available online:
http://www.acumentraining.com/AcumenJournal.html

PostScript Programming Questions
Newsgroups
comp.lang.postscript
fr.comp.lang.postscript (French)
fj.comp.lang.postscript (Japanese)


$$$ Commercial Products $$$

PostScript Viewers
If you want to print PS files from Windows, these products costs less than buying a printer with built-in PS capability.

Lincoln & Co. has software that views level-2 PS, PCL, and HPGL documents, searches for text, and prints to any MS Windows printer.
(US dollars) $59 (free demo)
http://www.lincolnco.com/viewers.htm

ROPS is a PS interpreter for MS Windows that uses TrueType fonts.
Level-1 PS: Free. Level-2 PS: (US dollars) $50 (free demo)
http://www.rops.org/

PREVIEW: PS for Windows
Preview is a level-2 PS interpreter that lets you view and print PS files and convert them to Windows MetaFile (.WMF) format. Works with your web browser to view PS files on the Web.
A very economical way to add PS viewing and printing to MS Windows.
(US dollars) $29 (free demo)
http://www.lib-sys.com/preview.htm

An even cheaper way to view and print PS is Ghostscript.

Mac users: Try using Preview, Mac's built-in graphics viewer. If you have OS X 10.3 or better, you should be able to view and print PS and EPS files.

PostScript Editors

Adobe Illustrator and Corel Draw can create and edit PostScript.
SOLVERO, a PS Editor
Solvero can read, validate, display, and interactively edit text, graphics, and images in PostScript, EPS, and PDF files from any source.
Prepress shops use this kind of software.
(Win2000/NT, Mac OSX)
http://www.onevision.de

IMPORTPS imports a single page of PS or PDF as an editable vector graphic into MSOffice or any program that supports the Aldus interface. (MSWin; requires Ghostscript and GSView to run) (US Dollars) $40 (free demo)
http://www.fam-glunz.de/wglunz/importps/

See also Importing EPS into MS Word page.
PSALTER, a PS Programming Tool
PSAlter helps you debug your PS program by executing it one step at a time, while displaying the graphics state, the contents of stacks, and comprehensive error messages. Converts PS to TIFF, BMP, and EPS.
If you're writing PS programs, you'll be interested in this tool; it's the finest available.
(MSWin) (UK pounds sterling) £200
http://www.quite.com/psalter/

Graphics-File Converters
IMAGE ALCHEMY, a graphics-file converter
Converts any of 90 image formats to PS. (US dollars) $90. Image Alchemy PS includes a PS level 2 interpreter to convert any of 90 image formats to and from PS, EPS, and PDF. (US dollars) $400
(Available for many OS's) Free on-line demo.
http://www.handmadesw.com/Products/Image_Alchemy_PS.htm

THE GRAPHICS CONNECTION
Converts PS/EPS/PDF files to vector formats (WMF, CGM, MIF, EMF, HPGL, EPS, SVG, DXF), to bitmap image formats (TIFF, GIF, EPSI, EPSF, JPEG, PNG) and extracts ASCII text. Available in desktop, server (batch) and developer (API) versions. (Windows 95/98/NT/2000/XP, Unix HP/IBM/Sun/Linux) (US dollars) $195 and up (free demo, free test file conversion)
http://www.square1.nl/

CONVERTPS
Converts PS, EPS, and AI to WMF, EMF, JPG, GIF, TIFF, BMP, PCX, EPS, PDF, DXF, PNG, and SGV formats, views and prints PS files, enables opening a PS file in any Windows application.
(MSWin) Free online demo (Euro) €250
http://www.hake-said.de

KONVERTER
Converts PS and PDF to and from 609 graphics formats.
(MSWin) Free demo (Euro) €20
http://www.logipole.com/

Lincoln & Co.'s software converts level-2 PS, EPS, PCL, and HPGL to TIFF, PCX/DX, and bitmap formats.
(MS Windows, Unix, Linux) Free demo.
http://www.lincolnco.com/converters.htm

TRANSVERTER PRO
A PDF, PS and EPS file conversion utility. Contains a level-3 PS interpreter for viewing, converting, RIPping (rasterizing) PDF, EPS, and PS files. Output formats include EPS, GIF, JPEG, TIFF, WMF, EMF Illustrator and others. Hot Folders and Batch Conversion for workflow automation.
(Win2000/XP & Mac OSX) (US Dollars) $495 (Free demo)
Also, PS plug-ins available for Freehand, Photoshop, Quark and others.
http://www.techpool.com

Other Software
POSTERSHOP PS, a poster maker
Software for printing PS files on inkjet printers and large-format inkjet plotters. It lets you view, enlarge/reduce, crop, rotate, tile, and color-correct images. (MSWin 95 and NT) (US dollars) $495
http://www.onyxgfx.com/solutions_postershop.html
If you don't need all these features, you might be interested in Poster.

PREVIEW SDK and PSI
Windows developers will be interested in these kits which let you read PS and PDF documents into their applications.
http://www.lib-sys.com/pvsdk.htm

TGC/DLL and TGC/Developer
These PS interpreters allow developers to integrate PS capability into their Win95/NT and Unix applications.
http://www.square1.nl/

JAWS and HARLEQUIN RIPs are available from Global Graphics
The PHOTOSCRIPT PS interpreter (for Unix, Win, Mac) is now owned by Cadlink
STYLESCRIPT was discontinued in January 2001
RIP stands for "Raster Image Processor", meaning that it accepts PS (vector format) and produces output for a printer (raster format).


Merging

MERGE SEVERAL PS FILES INTO ONE FILEIf you need to merge two or more PS files into one big PS file, it's really rather simple. Just copy them, one after the other, into the final file. If that works, you're done.If that doesn't work, add the following line of text between each pair of PS files: false 0 startjob popwhere "0" is the number zero. For further information, click here.
Thanks to John Deubert for this elegant solution.


Extracting
EXTRACT TEXT FROM A PS DOCUMENT
A frequently asked question is, "How can I extract the text from a PostScript document?

It's actually quite difficult.

The best way is to go back to the program which produced the PostScript document, and ask it for the plain text. If you have no way to do that, you can try the following.

PSTOTEXT extracts the ASCII text from a PostScript or PDF document. (Requires Ghostscript to run.)
MSWin and OS/2:
This program is included in GSView 2.0 and later.
MSDOS executable:
http://www.cs.ruu.nl/pub/TEX/MSDOS/pstotext.zip
Documentation and Source Code (you compile):
http://www.research.digital.com/SRC/virtualpaper/pstotext.html

PRESCRIPT is another ASCII extractor. The site contains links to similar programs. (Requires Ghostscript and the Python interpreter)
http://www.nzdl.org/html/prescript.html

Another method for extracting text from a PostScript document is to convert it to a bitmap graphics file (at perhaps 300 bpi resolution). An OCR program can then process the graphics file and produce a text file. (The paper-intensive equivalent would be to print the PS file, scan each page with a document scanner, and use the OCR program from there.)

EXTRACT IMAGES FROM A PS DOCUMENT

PSRIP extracts the images from PostScript documents. (Requires Perl to run.)
http://www.dante.de/CTAN/support/psrip/

EXTRACT-EPS extracts the eps images from a PS document and adds their bounding-boxes. (Requires Perl to run.)
http://www-hermes.desy.de/notes/extras/postscript.html

Converting
CONVERT PS to something else

PSTOEDIT translates PostScript into Flattened PostScript, PDF, TGIF .obj format, (Frame)Maker Intermediate Format, XFIG .fig format, Idraw format, gnuplot, Gnu Metafile, CGM, DXF, LWO, RIB, RPL, Tcl/Tk, Java applet, HPGL, AI, WMF, EMF, RTF, PIC, SGV, MetaPost, LaTeX2e, Killustrator, and OS/2 meta files.
Win95/98/NT (included with GSView); for Unix, source code, you compile (Requires Ghostscript to run)
http://www.pstoedit.net/pstoedit

IMAGE MAGICK displays, manipulates, and converts over 70 image formats, including PostScript, EPS, and PDF (which require Ghostscript to run). (X-Window System, requires X library to run. Source code and executables for many OS's.)
http://www.imagemagick.org/

NETPBM converts PS to/from over 80 graphics formats. (Linux)
http://sourceforge.net/projects/netpbm/

GHOSTSCRIPT converts PS to PNG, JPEG, PNM, TIFF, BMP, PCX, PSD, PDF, EPS, PCL-XL.

If you have many files to convert, set up Ghostscript batch jobs with GoBatchGS.

PS2HTML converts a page of PS into a web page, using tables, lists, and images to recreate the document. (Beta version, Unix) (This page is sometimes unavailable. If you get a "Forbidden" error message, send email to the webmaster requesting that they make it available again.)
http://www.csd.uch.gr/~nikop/thesis.html

IMAGE ALCHEMY will convert your PS/EPS/PDF file for free to demonstrate their versatile software. You FTP your file to them, you get the converted file back.

THE GRAPHICS CONNECTION has a similar free offer.

Or try the free conversion service on the TOMSERVER at Carnegie Mellon Univ.

CONVERT something else to PS

MPAGE formats a text file (including n-up printing) and sends it to a PS printer. (Unix)
http://www.mesa.nl/download.html
ENSCRIPT is similar. (Unix, Win95/NT, OS/2)
http://people.ssh.com/mtr/genscript/

A2PS converts an ASCII text file to PS. Includes n-up, borders, headers, fonts, colors, and pretty-printing of code. (Website also has links to a2print, nh20s, ga2ps, Ogonkify.) (Unix, Win95/NT)
http://www.inf.enst.fr/~demaille/a2ps/

HTMLDOC converts HTML to PS and PDF. (Unix, Win95/NT)
http://www.easysw.com/htmldoc/

HTML2PS converts HTML to PS. (Perl)
http://www.tdb.uu.se/~jan/html2psug.html

KVEC converts bitmap graphics (BMP, GIF, TIFF, ART) into PostScript and other vector formats (WMF, DXF, HPGL, ART). (Win95/NT, OS/2, NEXT, Unix) Shareware: (US dollars) $25
http://www.kvec.de/

AUTOTRACE converts bitmap graphics (BMP, TGA, PNM, PPM, PGM, PBM) into PS and other vector formats. Source code, you compile.
http://sourceforge.net/projects/autotrace/

JPEG2PS translates JPEG into PS without uncompressing the image data. (DOS, Unix)
http://www.pdflib.com/products/more/jpeg2ps.html

JPEG2EPS translates JPEG into EPS without uncompressing the image data. (All OSs, requires Ghostscript and GhostView)
http://rses.anu.edu.au/~andy/jpeg2eps/

IMG2PS converts PGM, PPM, GIF, or JPEG to EPS or standalone PS. It maintains JPEG files's compression, and preserves color mapping in GIF files. (Linux)
http://www.cs.cmu.edu/~chuck/softpg/

WMF2EPS converts Windows Metafile (WMF, EMF) into EPS with proper bounding-box. (Win95/98/2000/ME/NT)
http://www.wmf2eps.de.vu/

HP2PS converts HPGL to PostScript. (Dos, Windows, Unix) Shareware: Free download, (US Dollars) $25 to register.
http://www.wftpd.com/downloads.htm

HP2XX converts HPGL to several formats, including EPS. (Source code, you compile)
http://www.gnu.org/software/hp2xx/hp2xx.html

ViewCompanion views and converts HPGL/2 to many formats, including PS and PDF. (MsWin) Free download, (US Dollars) $49 to register.
http://www.softwarecompanions.com/viewcomp.html

PCLTOOLS converts PCL to PDF, views PCL, and prints PCL to non-PCL printers. (MSWin)
http://www.pcltools.com
PCL2PDF has similar features. (MSWin and other OSs)
http://www.visual.co.uk/Pcl2pdf.html
GhostPCL views and prints PCL and HPGL/2. (Source code, you compile)
http://www.artifex.com/downloads/

Convert anything to PS
A simple conversion of any document to PS is easy if you have a Windows application which can print the document. For example, MSWord will convert .doc to PS, Netscape or Internet Explorer will convert HTML to PS, and so on.
You'll need to install a PostScript printer driver (see note below).
Then you start the application, open the document and print it, selecting the PS printer driver you've installed, and the "print to file" option. The file produced is the PS version of your document. (Last step: Change the filename extension from .prn to .ps)

Note: To install a printer driver in Win95:
Start, Settings, Control Panel, Printers, Add Printer, choose printer.
Which PS driver to install?
If the PS will be printed only on one particular printer, use the specific driver for that printer.
Otherwise, try for a lowest-common-denominator driver. The Apple Laserwriter II NT driver is often recommended for this purpose, since it generates really elementary PS which most any PS printer can print.
Or try one of the default drivers that come with the Adobe PS driver.
(Avoid HP drivers -- they generate PCL along with the PS, making them useless for this purpose.)

Other Web Resources
Don Lancaster has long championed PostScript as "an unappreciated yet superb general purpose computing language". His website is a library of PS and PDF info, instruction, programs, utilities, and "secrets". Lots of stuff here.
Richard Bethell's webpage is an interesting source of information about PostScript, fonts, Desktop Publishing (DTP), and related lore.
Randolph J. Herber has a page of advice, "How to use Adobe PostScript language files properly."
Herb Weiner's collection of PostScript Quick Tips includes a utility for printing samples of fonts, how to permanently download PS code to your printer, converting PS to EPS, creating a mirror-image font, putting a message ("watermark") in the document background, and printing ransom notes.
David Byram-Wigfield offers Tinydict Book Typesetter for simple do-it-yourself typesetting and publishing using PS instead of DTP software. His book Practical PostScript is an introduction to PS fonts and typesetting. Many tools and tips for self-printing books.
Olavi Sakari has developed a program for automatic hyphenation.
Peter Kleiweg has tips for adding depth to type, rotating a character with drop-shadow, editing PS with Emacs, X Fonts, adding an " src="http://www.geocities.com/SiliconValley/5682/graphics/ArwCurv.jpg" width=55 border=0> arrowhead to a curved line, creative typesetting and generating Fractals.
Frank Siegert has developed PStill, a PS-to-PDF converter for many OSs, and PSCHECK, a PS and EPS checker for MSDOS and Linux. For the NEXT OS, he's developing FDW, which converts a PS file into an EPS file or DSC-compliant PS file, and BeYAP, a PS viewer and program-debugging tool. Frank's PS program calculates pi to over a quarter-million decimal places.
ToastScript is a level-1 PostScript interpreter written entirely in Java, which makes it attractive for Internet and intranet use. You can download it and use it as a a PS Web Browser to view PS files on the web. Or if you have a PS file on your website, you can use ToastScript as a Java applet which makes the PS file viewable by anyone with a Java-enabled web browser. (Ghostscript isn't involved here, merely free Java software from Sun.)
Samuraj Data has a PS and PDF viewer on the web.
Thomas Kiffe has Mac versions of Ghostscript, PS2PDF, and TeX.
Jeffrey Kingston developed Lout, which produces PS and PDF from a text file marked up with Lout format tags. Many features, including equation formatting, multilingual hyphenation, tables, eps figures, indexing, and cross-referencing.
Lilypond, the GNU music typesetter, can convert a text file to sheet music in PS. The site also has links to similar software.Mup is easier to install and use. You enter an ASCII text file and get midi files and PostScript sheet music. (MS-Dos, Unix, Linux, or compile your own) Shareware: Free download, (US Dollars) $29 to register.See also Peter Billam's Muscript, a Perl program for typesetting music in PS.
Paul Wessel has GMT, which produces EPS illustrations from (x,y) and (x,y,z) data sets, from simple x-y plots through contour maps to artificially illuminated surfaces and 3-D perspective views in color. This huge, powerful package is free (Unix/Linux, Dos, OS/2, Mac).

2.
Tips for Manipulating Postscript

By N.C.R. Makins
From http://www-hermes.desy.de/notes/extras/postscript.html

Translating postscript files from A4 to US Letter format
Unfortunately, the majority of our documents are in A4 format, while many of our collaborators must use US Letter printers. Here are some ways to translate files from one format to the other:


If you have the psresize utility available, it works very well:
psresize -PA4 -pletter a4file.ps letterfile.ps

If not, then ...

If you have a sufficiently advanced version of the psnup program on your machine, this will work:
psnup -pletter -Pa4 a4file.ps letterfile.ps

This scales the A4 text down by 0.94, and applies a small horizontal shift of 7 points. If psnup fails for you, the same transformation can be accomplished using pstops:
pstops '0.94@1(7,0)' a4file.ps letterfile.ps

If that also fails, you can use the following simple perl script:

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0;

# Translate A4 to letter via a rescaling and a horizontal shift.
# -- gnome

goto HELP if ($#ARGV <>>> output file $ARGV[1] already exists, overwrite? [=no] ";
$text = ;
print "\n";
exit(0) if (!($text=~/^\s*y/i));
}
open (A4,"<$ARGV[0]"); open (LETTER,">$ARGV[1]");
while () {
print LETTER;
next if (!/^%%Page:/);
print LETTER "7 0 translate\n0.94 0.94 scale\n";
}
close(A4); close(LETTER);

exit(1);

HELP:
print "\nUsage: a4toletter \n";
print "\n"; exit(0);

You use it like this:
a4toletter a4file.ps letterfile.ps


According to Andy, almost all A4 documents merely require a downward translation by 25 points to be printable on US Letter paper. As long as the text doesn't stray too close to the margins, this solution avoids the 6% loss in type size caused by the previous method. Again, the y shift can be done with pstops:
pstops '0@1(0,-25)' a4file.ps letterfile.ps

or with a perl script: a4toletter-shift

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0;

# Translate A4 to letter with only a vertical shift (no rescaling).
# -- gnome

goto HELP if ($#ARGV <>>> output file $ARGV[1] already exists, overwrite? [=no] ";
$text = ;
print "\n";
exit(0) if (!($text=~/^\s*y/i));
}
open (A4,"<$ARGV[0]"); open (LETTER,">$ARGV[1]");
while () {
print LETTER;
next if (!/^%%Page:/);
print LETTER "0 -25 translate\n";
}
close(A4); close(LETTER);

exit(1);

HELP:
print "\nUsage: a4toletter \n";
print "\n"; exit(0);

Once more, usage looks like this:
a4toletter-shift a4file.ps letterfile.ps

Extracting figures from postscript files
Postscript files which include figures actually preserve the source of the original eps files intact. You can easily extract the figures ... they are framed by two distinctive lines in the ps file:

%%BeginDocument
...
%%EndDocument

You can extract the eps files by hand in a text editor. Note, however, that the bounding box for the eps figure is lost. (Well, not exactly, but it's a bit complicated to pull it out, and I haven't verified a robust method yet). The easiest thing to do is to simply run ps2epsi on the code you extracted ... it will make the bounding box for you, and insert the usual eps header lines.
Here is a perl script which does all this automatically for you: extract-eps.

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0;

# Usage: extract-eps [-a] [-l] [-n] [-fig] [ps-files ...]
# --gnome

# ... 1: always overwrite, 0: ask, -1: never overwrite
$overwrite = 0;
$listonly = 0;
$add_figno = 0;
$have_ps2epsi = 1;
$tmpfile = ".tmpextract.eps";
$needhelp = 0;
foreach $text (@ARGV) {
last if (!($text=~/^-/));
if ($text=~/-a/) {$overwrite = 1}
elsif ($text=~/-n/) {$overwrite = -1}
elsif ($text=~/-l/) {$listonly = 1}
elsif ($text=~/-fig/) {$add_figno = 1}
elsif ($text=~/-[\?hH]/) {goto HELP}
else {print "Unrecognized option $text \n"; $need_help = 1};
shift(@ARGV);
}
goto HELP if ($need_help);

$epsfile_open = 0;
$figno = 0;
$oldfile = '000000';
while (<>) {
if ($oldfile ne $ARGV) {
$oldfile = $ARGV;
$text = $listonly ? "Listing" : "Extracting" ;
print "\n$text eps files ", (($ARGV ne "-") ? "from $oldfile " : ""), "...\n";}
if (!$epsfile_open) {
next if (!/^%%BeginDocument:/);
($epsfile) = /^%%BeginDocument:\s*(\S+)/;
if ($epsfile=~/\//) {$epsfile =~ s/.*\///;}
++$figno;
if ($add_figno) {$epsfile = "fig$figno-$epsfile"};
if ($listonly) {
print " Found file $epsfile \n";
next;
}
if (-e $epsfile) {
next if ($overwrite < overwrite ="="">>> File $epsfile already exists, overwrite? [=no] ";
$text = ;
$overwrite = 1 if ($text=~/^\s*Y/);
$overwrite = -1 if ($text=~/^\s*N/);
next if (!($text=~/^\s*y/i));
}
}
open (EPS,">$epsfile");
$epsfile_open = 1;
} else {
if (!/^%%EndDocument/) {print EPS "$_" ; next}
close (EPS);
print " Extracted file $epsfile";
$epsfile_open = 0;
if (!$have_ps2epsi) {print "\n"; next};
eval `ps2epsi $epsfile $tmpfile`;
if ($@) {$have_ps2epsi = 0}
else {eval `mv $tmpfile $epsfile`; print " ... created bounding box"};
print "\n";
}
}
print "Done.\n\n";
if (!$have_ps2epsi) {
print "NOTE: could not create bounding boxes with ps2epsi.\n\n"}
exit(0);

HELP:
print "\nUsage: extract-eps [-a] [-n] [-l] [ps_files ...]\n";
print "\n -a : always overwrite existing eps files";
print "\n -n : never overwrite existing eps files";
print "\n -l : only list eps files, do not extract";
print "\n -fig : prefix extracted eps filenames with fig#";
print "\n ps_files : postscript taken from STDIN if ps_files not provided \n";
print "\n"; exit(0);

Basically, you type

extract-eps file.ps

and all embedded eps files will be extracted (using their original filenames). Type
extract-eps -h

to learn about a few command line options that are available.

Changing colour postscript to black-and-white
If often happens that you have a lovely colour figure that you would like to render in black-and-white ... for example, a plot that you showed at a talk, but must now include in a printed proceeding. If you don't have a B&W version of the plot at hand, you can convert your colour file. The two simplest choices are:

Take the RGB (red-green-blue) specification of each colour, average the values, and use that as a grayscale setting.
Turn all colours (and any grayscales) to black.
The second option is perhaps better for plots, while the first is more suitable for figures and diagrams. It depends a lot on the particulars of your colour file.
Here is a perl script which performs either of these manipulations: bw_convert.

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0;

# convert colour files produced by PAW into BW styled files
# -- Uta 1.11.00, outer Perl frame based on Naomi's script
# -- Naomi 14.3.01, replaced colour 'black' (not always defined), and
# added grayscaling

$use_gray = 1;
$need_help = 0;
foreach $text (@ARGV) {
last if (!($text=~/^-/));
if ($text=~/-b/) {$use_gray = 0}
else {print "Unrecognized option $text \n"; $need_help = 1};
shift(@ARGV);
}
goto HELP if ($need_help);
goto HELP if ($#ARGV != 1);

if (-e $ARGV[1]) {
print "\n >>> Output file $ARGV[1] already exists, overwrite? [=no] ";
$text = ;
print "\n";
exit(0) if (!($text=~/^\s*y/i));
}
open (COLOR,"<$ARGV[0]"); open (BW,">$ARGV[1]");
while () {
if ($use_gray) {
s/\bsetrgbcolor\b/add add 3 div setgray/g;
} else {
s/\bsetgray\b/pop 0 setgray/g;
s/\bsetrgbcolor\b/pop pop pop 0 setgray/g;
}
print BW;
}
close(COLOR); close(BW);

exit(1);

HELP:
print "\nUsage: bw_convert [-b] \n";
print "\n -b : convert all colours and grays to black\n";
print "\n"; exit(0);

The usage syntax is

bw_convert [-b] colour-file.ps bw-file.ps

The -b option engages procedure #2 above -- convert all colours and greys to black. Otherwise, procedure #1 is used.

About the perl scripts
After you download the little scripts, you must of course do chmod a+x before they will run. :-)

The Quest for Wizardry
Postscript is a programming language, just like FORTRAN, C, or PERL. Postscript files are in ASCII text, just like any other source code, and so can be readily hacked ... if you know the language. :-) In fact, it is a rather nice language, extremely similar to that of an RPN calculator -- if you have ever used such a calculator, the syntax of postscript will be perfectly intuitive to you. Here are 4 links that can take you all the way from Acolyte to Wizard:

A First Guide to Postscript, by Peter J. Weingartner, is the ideal place to start. It is brief, extremely well written, and teaches you about 95% of what you need to know to be a consummate ps hacker. One little tip: when you start hacking ps files, be aware that almost all programs that write postscript (e.g. dvips or fig2dev) insert a lengthy header containing numerous definitions. If you start hunting around through the meat of a ps file, and find that you recognize none of the commands, it's simply because they were all defined (or redefined) at the beginning of the file (with a shorter name, if nothing else).
Paul Bourke's PostScript Tutorial is the next thing to read. It is much more brief than the previous document, but adds information about a couple of useful things, like coloured inks.
Now you have all the fundamentals under your belt, and you need a quick reference. Bookmark this: the Luminous Postscript Index. Happily for us, Mr. Milanek has copied the famous index from Luminous Corp (which seems to have vanished) to a computer in Czechoslovakia.
Do you have access to a printer where you can dump 900+ pages and not (a) go through $200 worth of inkjet cartridges or (b) incur the eternal wrath of your colleagues? If so, you may achieve Complete Mastery of postscript by downloading the Encyclopedia itself from the horse's mouth: the celebrated `Red-and-White Book', also known as the PostScript Language Reference, may be retrieved for free from Adobe.

3.
http://www.itee.uq.edu.au/~emmerik/visioeps.html



<< Home

This page is powered by Blogger. Isn't yours?