What is PostScript?

What is PostScript?

PostScript is a computer language designed explicitly for page description -- for printing graphics and text. It was introduced in 1985 by Adobe and is a great way to describe images in perfect precision and in a device-independent manner.

The language itself is in ASCII text and can be viewed (though perhaps not comprehended!!) in your text editor. Normally you are not intended to edit PostScript manually, but it is certainly possible, if you know the language. PostScript code, which is typically interpreted, is stack-based in the same manner as an RPN calculator. A program pushes arguments to an operator onto a stack and then invokes the operator. Typically, the operator will have some result which is left at the top of the stack. As an example, let us say we want to multiply 12 and 134. We would use the following PostScript code:

12 134 mul
The first two words '12' and '134' push the numbers 12 and 134 onto the stack. 'mul' invokes the multiply operator which pops two values off the stack, multiplies them, and then pushes the result back onto the stack. The resulting value can be left there to be used by another operator later in the program.

Another example is drawing purple line segments, with a line thickness of 10 points (approx 10/72 inches):

10 setlinethickness		% self-explanatory
0.62 0.13 0.93 setrgbcolor	% purple!
50 50 moveto  300 500 lineto 50 500 lineto stroke
The default coordinate system for an 8.5"×11" page (``letter size'') is 0 0 in the lower left corner to 612 792 in the upper right. Among the top few lines of a well-constructed PostScript file is bounding box information.

Fonts can be defined in a PostScript file, though it isn't necessary for basic fonts like Times, Helvetica and Courier. Figures and fonts can then be placed on a page using PostScript commands which give concise results with arbitrary resolution. It is also possible to describe bitmap images in PostScript, which results in huge file size and limited resolution.


TOP

How do we tell if a file is in PostScript format?

If you are on a Unix computer, and the name of the file in question is myfilexxx, then use the file command like this:
newton>  file myfilexxx
Or, if you don't mind taking a peek at the contents of the file, use a text editor (or a Unix command like `` top'') to check the first 2 characters of the top line of the file. PostScript files must always begin with the 2 characters `` %!''.
In some hp print,PostScript files don't begin with the 2 characters "%!", it will add some other chars like this:
....
%-12345X@PJL JOB
@PJL SET HOLD=OFF
@PJL SET RESOLUTION = 600
@PJL SET BITSPERPIXEL = 2
@PJL SET ECONOMODE = OFF
@PJL ENTER LANGUAGE = POSTSCRIPT
newton>  top -5 myfilexxx
%!PS-Adobe-2 EPSF-2
%%BoundingBox: 6 6 606 790
%%BeginFont
11 dict begin


TOP

What is the difference between Encapsulated PostScript and (plain) PostScript?

An Encapsulated PostScript file is not intended to be printed by itself. It is a single image, not a whole page or multiple pages, and is intended to be included as part of a larger document. In particular, an EPS file won't necessarily include the PostScript command `` showpage'', which is the cue to a printer to actually print the page. That is, an EPS file may not print by itself! Sometimes it will, but don't count on it. After all, by definition, an EPS file is intended to be encapsulated inside a larger document, not stand by itself.

Because an EPS image is intended to be inserted inside a larger document, it is crucial that it have accurate bounding box information, so that the documentation software knows the size of that image.

Otherwise, an EPS file is just like any PostScript file; it may consist of a bitmap image, or it may consist of font definitions and drawing commands. Common usage names EPS files with the suffix .eps, and (printable/multipage) PostScript files with .ps. Of course, it is the content of the file which counts; just naming a file ``*.eps'' doesn't make it EPS.


TOP

Are EPS files always bitmap images?

No.

An EPS file may consist of a bitmap image, but then, any PostScript can contain bitmap images. Bitmapped images are only one of dozens of possible PostScript entities, which include text, lines/polygons, arcs/ellipses and bezier curves.

Bitmap images only make sense in the case of photographic images. Expressing mathematical images, drawings, graphs and text as rectangular array of pixels -- bitmaps -- is inefficient and crude. Such images are defined more concisely and look better when defined with PostScript commands in terms of arcs, polygons, colors, coordinates, etc.


TOP

How do we tell whether a file is Encapsulated-PostScript or just PostScript?

First, make sure that the file is indeed PostScript (see how, above).

If the top line of the file says something like ``%!PS-Adobe-3.0 EPSF-3.0'' then it is an Encapsulated PostScript single image. If it just says ``%!PS-Adobe-3.0'' then it is a PostScript (possibly multi-page) document.

Or, check the number of pages. A standard-conforming PostScript file includes a comment line near the top naming the number of pages, so you could try grepping for the string ``%%Pages'', like this:

newton>  grep '%%Pages' myfilexxx
If that line says ``%%Pages: 0'' then it's definitely Encapsulated PostScript. If it says ``%%Pages: 1'' then it can serve as Encapsulated, whether or not it was created with that intent. But if the number of pages exceeds 1 then it is definitely *not* EPS. (You could also just preview the file with ghostview to see whether it has only one page or not.)

Finally, the command ``showpage'' in a PostScript file is what instructs a printer to print a page. Sometimes it works to grep for that word; if it occurs only once (or not at all) in a PostScript file, then that file can be considered Encapsulated.


TOP

What is PDF?

Portable Document Format is a document-description language also created by the Adobe, Inc., and it is based on PostScript. PDF files are typically, but not necessarily, named with a *.pdf suffix. If you run the command `` file'' on such a file, it will be correctly identified:
newton>  file myfilexxx
myfilexxx:       Adobe Portable Document Format (PDF) v1.2
You cannot print a PDF file using lp nor can you preview it using ghostview. Instead, use acroread (or Acrobat Reader), a free PDF reader provided by Adobe. With this reader you can display a PDF document at any magnification on the computer, and print selected pages using the menu. (The PDF reader converts pages to PostScript when sending them to a PostScript printer.)

Since Adobe's PDF reader is of high quality and is free, it is reasonable to expect all of our webpage readers to have it on their computers (certainly all the ITS labs' computers do), so this is an ideal format for posting documents. It combines good quality and resolution when displayed on monitors (using the Adobe reader) with good quality and resolution when sent to the printer, with compact file size. Your PostScript document can be converted to PDF using the command ps2pdf. (In the case of LaTeX documents, bypass PostScript entirely by converting your DVI file directly to PDF using dvipdf.)

转载于:https://www.cnblogs.com/umlchina/archive/2007/07/12/printandpostscript.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
信息数据从传统到当代,是一直在变革当中,突如其来的互联网让传统的信息管理看到了革命性的曙光,因为传统信息管理从时效性,还是安全性,还是可操作性等各个方面来讲,遇到了互联网时代才发现能补上自古以来的短板,有效的提升管理的效率和业务水平。传统的管理模式,时间越久管理的内容越多,也需要更多的人来对数据进行整理,并且数据的汇总查询方面效率也是极其的低下,并且数据安全方面永远不会保证安全性能。结合数据内容管理的种种缺点,在互联网时代都可以得到有效的补充。结合先进的互联网技术,开发符合需求的软件,让数据内容管理不管是从录入的及时性,查看的及时性还是汇总分析的及时性,都能让正确率达到最高,管理更加的科学和便捷。本次开发的医院后台管理系统实现了病房管理、病例管理、处方管理、字典管理、公告信息管理、患者管理、药品管理、医生管理、预约医生管理、住院管理、管理员管理等功能。系统用到了关系型数据库中王者MySql作为系统的数据库,有效的对数据进行安全的存储,有效的备份,对数据可靠性方面得到了保证。并且程序也具备程序需求的所有功能,使得操作性还是安全性都大大提高,让医院后台管理系统更能从理念走到现实,确确实实的让人们提升信息处理效率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值