Questions tagged [postscript]

PostScript is a Turing-complete page description programming language, designed and developed by Adobe. There are three major releases: PostScript Level 1, released in 1984. PostScript Level 2 (1991) contained several important improvements. PostScript 3 (1997) is the latest version.

PostScript Overview

PostScript is a reverse-polish stack-based, dynamically-typed, dynamic-namespacing, scripting language with built-in primitives for generating rendered images from vector descriptions. PostScript employs the same "Adobe Image Model" as the PDF file format.

PostScript is used as an output format by many programs since it is designed to be easily machine-generated.

Like LISP, PostScript is homoiconic and code and data share the same representation. Procedures can take procedures as data and yield procedures as results, lending itself to techniques from concatenative-programming as well.

General Description of PostScript

PostScript is a Turing-complete general programming language, designed and developed by Adobe Systems. Many of the ideas which blossomed in PostScript had been cultivated in projects for Xerox and Evans & Sutherland.

Its main real-world application historically is as a page description language, or in its single-page EPS form a vector-graphics image-description language. It is dynamically-typed, dynamically-scoped, and stack-based which leads to a mostly Reverse Polish syntax.

There are three major releases of PostScript.

  1. PostScript Level 1 — this was released to the market in 1984 as the resident operating system of the Apple LaserWriter laser printer, inaugurating the Desktop Publishing Era.
  2. PostScript Level 2 — released in 1991, this contained several important improvements to Level 1, including support for image decompression, in-RIP separation, auto-growing dictionaries, garbage collection, Named Resources, binary encodings of the PostScript program stream itself.
  3. PostScript 3 — the latest and perhaps most widely adopted version was released in 1997. It too contains several import improvements over Level 2 such as Smooth Shading. The term “level” has been dropped.

Though PostScript is typically used as a page description language -- and therefore is implemented inside many printers to generate raster images -- it can also be used for other purposes. As a quick reverse-polish calculator with more memorable operator names than dc. As an output format generated by another program (usually in some other language).

Though PostScript files are typically 7-bit-clean ASCII, there exist several kinds of binary encoding described in the level 2 standard. And being programmable, a program may implement its own arbitrarily-complex encoding scheme for itself. There is an International Obfuscated Postscript Competition, somewhat less active than the C one.

Online References

FAQs

Books

  • Postscript Language Reference Manual, 1ed, 1985. Recommended for its small size, and easy operator index from the summary pages (missing from later editions).

  • Real World Postscript. Chapters by various authors on various topics, including excellent coverage of halftoning.

Curriculum

Read the documentation in this order to easily learn postscript:

  1. Paul Bourke's excellent tutorial: http://paulbourke.net/dataformats/postscript/

  2. Blue Book, first half, the original official tutorial:
    http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF

  3. Green Book, how to use postscript effectively:
    http://www-cdf.fnal.gov/offline/PostScript/GREENBK.PDF

  4. Thinking in Postscript, 'nuff said: http://wwwcdf.pd.infn.it/localdoc/tips.pdf

  5. Mathematical Illustrations. Start small, build big. The math behind Bezier Curves. The Hodgman-Sutherland polygon clipping algorithm. Affine transformations and non-linear transformations of the path. 3D drawing and Gouraud shading. From the preface:

Which [of the many tools to help one produce mathematical graphics] to choose apparently involves a trade-off between simplicity and quality, in which most go for what they perceive to be simplicity. The truth is that the trade-off is unnecessary — once one has made a small initial investment of effort, by far the best thing to do in most situations is to write a program in the graphics programming language PostScript. There is practically no limit to the quality of the output of a PostScript program, and as one acquires experience the difficulties of using the language decrease rapidly. The apparent complexity involved in producing simple figures by programming in PostScript, as I hope this book will demonstrate, is largely an illusion. And the amount of work involved in producing more complicated figures will usually be neither more nor less than what is necessary.

Installation and/or Setup

The authentic Adobe PostScript interpreters are available in high-end printers, the Display PostScript (DPS) product, and the Acrobat Distiller product. As authors of the standard, these products are considered "the standard implementation" for the purpose of describing differences among PostScript implementations.

The Standard interface to the interpreter defined in the PLRM is the program-stream which may be either text or binary depending upon the details of the underlying channel or OS/controller. Acrobat Distiller has a GUI front-end to select the input postscript program and render its output as a pdf. Distiller also has some limited support for using the output text stream for reporting errors and other program output. GSView provides a similar GUI front-end for a similar workflow using Ghostscript as the interpreter.

Ghostscript and Xpost both work in a command-line mode. The postscript program file to run can be mentioned on the command-line (gs program.ps or xpost program.ps) which will open a graphics window to display the graphical output. Options may be used to render the graphics somewhere else like a disk file or suppress the graphics entirely and use postscript just as a text scripting language.

The various interpreters each have their own installation and setup instructions and it would be wasteful (and prone to falling out-of-date) to reproduce them here.

Freely-available PostScript interpreters

  • Ghostscript is available for all major platforms and Linux distributions, in source or binary form, under the GNU license or under other license arrangements with the authors, Artifex software. Ghostscript implements the full PostScript 3 standard.

  • Xpost is available in source form for all major platforms, under the BSD-3-clause license. It implements the Level-1 standard with some Level-2 extensions and some DPS extensions.

There is more introductory material that was formerly part of the SO Documentation project.

1059 questions
-1
votes
1 answer

Making a postscript file out of a PDF and print it

I would like to know how I can take an existing PDF with multiple pages, and I need to print every page multiple times. For example I have a 3 page PDF. I need the output to be 111 222 333 and not just 3 copies (123 123 123). What exactly is the way…
master2080
  • 366
  • 3
  • 15
-1
votes
1 answer

Multiple pages in postscript file

I have to create a postscript file where are multiple pages with different properties and graphics. That doesn't sound complicated since showpage is used, but the problem is I have to put showpage into a repeat loop. I don't understand how this can…
-1
votes
1 answer

How can I change type 3 font using ghostscript?

I have a postscript file which contains Type 3 Font.After converting that postscript to pdf using "gs" command ,I am unable to extract the text from pdf file.Is there any possibility to avoid change Type 3 Fonts to some other font, by substituting…
prasad
  • 339
  • 8
  • 23
-1
votes
2 answers

Running a postscript file on cygwin

i have written a small c++ code to generate a postscript file. i have installed ghostscript viewer. i am trying to open .ps file in cygwin but got this below error. $ gs.exe fill_rect_chd.ps GPL Ghostscript 9.15 (2014-09-22) Copyright (C) 2014…
PrimeOfKnights
  • 426
  • 5
  • 17
-1
votes
2 answers

I'm trying rename a postscript file based on the first line of text of that file using powershell

I'm super new to PowerShell, usually just using one line commands to get things done, but have been asked if I can take a batch of postscript files that are created from a mainframe and rename them based on the first line of that file then move them…
NateL
  • 1
  • 1
-1
votes
1 answer

acroread pdf to postscript conversion too slow

I am converting pdf file in postscript file using acroread command. The conversion is successfull but it is too slow and almost uses 100% of CPU, because of this my application hangs for some time and thus no user is able to do anything. The code…
Ray
  • 75
  • 1
  • 10
-1
votes
1 answer

convert pdf color to black and white

I am looking for an (open-sourced, or at least free) solution to tune the color of a pdf (or equivalently, ps) file, to black-and-white. Here are some technical specifications. It should NOT be gray scale. It must contain at most two colors: black…
user1539634
-1
votes
2 answers

Bash Printing, how to

Wrote a script in bash. Now im need to bring information into a text file,for example in PostScript, but there is one problem. I need to have a certain length of string in characters, and stretch or shrink the string on the entire width of the page…
Uncle Leo
  • 15
  • 2
-1
votes
1 answer

converting .eps file to .gif - size issue

I've been trying to convert some .eps files to .gif. The .eps files are pretty wide. When I use ps2img to convert them the .gif files which are produced contain only part of the image. The same problem occurs when I use 'xv' to open the .eps file…
-2
votes
1 answer

Printing from Internet Explorer and getting 20 pages of postscript instead

I have a very simple webpage that normally prints correctly from IE on many different computers. The page itself is just an html table and a heading. I tried printing Google's homepage and it printed correctly, so this this issue is specific to my…
dan
  • 9,712
  • 6
  • 49
  • 62
-2
votes
2 answers

Printer Port configuration using redmon and ghostscript, error invalid window handle

I want to print to pdf using Redmon and Ghostscript on windows 10, for which i added a new printer(set drivers to ghostpdf.inf) and added redirection port(RPT1). Now when i configure this port i get the error Invalid window handle, please check the…
Jay
  • 29
  • 6
-2
votes
1 answer

Halftone Postscript

In RIP devices, the Halftone screen dot shape code is required, for example: dot code like postscript language - {abs exch abs 2 copy add 1 gt {1 sub dup mul exch add 1 sub dup mul sub} {dup mul exch dup mul add 1 exch sub}, this code should be for…
shumnulu
  • 1
  • 1
-2
votes
1 answer

Postscript file editing for changing Print parameters

How to edit the Postscript file to update the Sets/No of Copies print parameter in PS file.What are different ways to edit PS file.I am programming in C#.Is it possible to pro grammatically edit Sets.
bhavya
  • 1
  • 2
-2
votes
1 answer

How to successfully convert math papers to plain text

Goals: 1.Develop a canonical method to use plain text to uniquely represent STEM papers in general and math papers in particular. Develop softwares that can convert existing typed STEM papers into that canonical form with 100% accuracy. Note that…
Ying Zhou
  • 189
  • 3
  • 16
-2
votes
2 answers

ghostscript hp8600 OfficeJet Pro

Running Centos 7, and latest gnuplot and ghostscript and hplip Not a newbie, but lost in this one. What command line do I use to get ghostscript/hplip to put out a file printable on HP OfficeJet HP86xx or similar. Thanks in advance. Homer W.…
1 2 3
70
71