Andrew September 21, 20200 Comments

What is PostScript format

What is PostScript format

September 21, 2020

When browsing the web, you may come across files with the .ps extension. A PS file is a document saved in PostScript format. It can contain vector graphics, bitmap graphics, and text. Now we will talk about this format in more detail.

PostScript is primarily known as the page description language used in e-publishing and desktop publishing. However, it is also a general-purpose programming language focused on supporting two-dimensional graphic design. As a language, PostScript has a structure that supports the efficient direct interpretation of the language at run time, rather than requiring a separate compilation step before the code can be executed.

Let’s consider a simple Postscript document:

% Simple PostScript Demo
2.83 2.83 scale
/DeviceRGB setcolorspace	
% --- Red Square ---
1 0 0 setcolor
10 10 moveto
40 10 lineto
40 40 lineto
10 40 lineto
closepath
fill	

% --- Green Square ---
0 1 0 setcolor
90 90 moveto
30 0 rlineto
0 30 rlineto
-30 0 rlineto
closepath
fill	

% --- Blue Square ---
0 0 1 setcolor
50 50 30 30 rectfill	

/DeviceCMYK setcolorspace
% --- Yellow Circle ---
0 0 1 0 setcolor
30 70 10 0 360 arc
closepath
fill

/DeviceGray setcolorspace
% --- Black Line ---
0 setcolor
4 setlinewidth
10 90 moveto
70 90 lineto
stroke

/Times-Roman findfont
28.3 scalefont
setfont
50 5 moveto
60 rotate
(God Morgon, PostScript!) show

showpage

In this document, three squares with 30 mm sides in red, green and blue are drawn, a yellow circle with a radius of 15 mm and a black line 60 mm long. The result of the program is shown in the figure below.


All colors in the program are set in the color spaces of the devices: monochrome, RGB, and CMYK.
Also, we printed the text rotated by 60° counterclockwise.
To demonstrate software techniques, each of the squares is drawn in its own way, using different language operators. Raster images do not use in this document.

As you can see, a Postscript document is a text document with special commands, and it will be tedious to create such a document manually. Let’s look at ways to create such documents using various programs.

How to create document in PostScript format

Creating PostScript document using Microsoft PostScript Printer Driver

If you using Windows 10, you can make a document in PostScript format using Microsoft PostScript Printer Driver. This method is suitable if you create documents using office or business applications such as Microsoft Office or QuickBooks.

  1. Select the Start button, then select Settings > Devices Printers & scanners > Add a printer or scanner.
  2. Click the link “The printer I want isn’t listed
  3. Click “Add a local printer or network printer with manual settings”
Printer & scanner window
  1. In the next step click “Use an existing port:” and choose “PORTPROMPT:”
"Choose a printer port" dialog
“Choose a printer port” dialog

5. And finally you should choose “Microsoft PS Class Driver”.

“Printer driver” dialog window

Now you can use any program that support printing and print data to newly created printer.

Creating PostScript document using Inkscape free app

Inkscape is a free vector graphics editor used to create vector images. Basically Inkscape used Scalable Vector Format for storing images, but it can also save documents in PS.

To store image as PostScript use File-Save As command.

Inkscape “Save As” dialog window

Convert a PDF to Postscript document

There are several ways to get a PS document from PDF. We can use the free Ghostscript app or the paid Adobe Acrobat.

GhostScript is an interpreter for the PostScript language and for PDF. The disadvantage of this method is that it’s a command-line utility. To convert PDF to PS you should use command-line and type a command, where mydocument.pdf is a path to your PDF document.

gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=mydocument.ps mydocument.pdf

Adobe Acrobat also can convert PDF documents to PS. Unlike GhostScript, Adobe Acrobat has a friendly graphical interface and we just need to use Export To->PostScript from the File menu.

So, we have seen the different ways of creating PS documents. In the next post, we will talk about how you can convert your PS document to other formats.

Leave a comment

Posted inAspose.Page App Product FamilyTags:
 

Related Articles

Categories