Saturday, January 3, 2009

More about PostScript than you may wish to know

When you create a page in QuarkXPress or PageMaker, you are interfacing with the program as displayed on the screen. Underlying what you see is what you get, and that is PostScript code. When you click Print, it is the PostScript code that is sent to the printer or imagesetter. You can even save the PostScript file to disk and read it. Here is some PostScript code. First, header information is output:

%!PS-Adobe-2.0 %%Title: PDF intro %%Creator: QuarkXPress 3.33 %%CreationDate: Tuesday, November 27, 2000 %%Pages: (atend) %%BoundingBox: ? ? ? ? %%PageBoundingBox: 30 31 582 761 %%For: Onamor Knarf %%DocumentProcSets: "(AppleDict md)" 71 0 %% © Copyright Apple Computer, Inc. 1989-92 All Rights Reserved. %%EndComments %%BeginProcSet: "(AppleDict md)" 71 0

In this case, the system sets up some shortcuts to reduce the verbose PostScript program commands to shorter versions, e.g., the command "moveto" becomes "/m".

/m/moveto load def /rm/rmoveto load def /l/lineto load def /rl/rlineto load def /np/newpath load def /cp/closepath load def

Then, font data is loaded (this is just a snippet):

373A767D4B7FD94FE5903B7014B1B8D3BED02632C855D56F458B118ACF3AF73FC4EF5E81F5749 042B5F9CF1016D093B75F250B7D8280B2EACE05A37037F7BDF6E12226D7D4E2DF2C52FAFD5F D40FE72A0D3AC4BD485D8369D4C87636E920D1DAF222D92155A9CB1667E715F0B82799B37CC8 F5B32B74B39CF494536DC39C7EF04A7BCB29E2CEC79073CADCCFB23B4AA1363F8

Every character in the fonts is defined:

/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute/agrave/acircumflex/adieresis/atilde/aring /ccedilla/eacute/egrave/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute/ograve/ocircumflex/ odieresis/otilde/uacute/ugrave/ucircumflex/udieresis/dagger/degree/cent/sterling/section/bullet/par agraph/germandbls/registered/copyright

Both PostScript and PDF use a notation known as "postfix." That is where the name PostScript came from. Postfix is an old mathematical notation, sometimes called reverse "Polish" notation. The "action" indicator, usually called the "operator," comes at the right-hand end of the expression (that is, after the variables) and complex expressions can be written without the use of parentheses. There is also a notation known as "prefix" notation, where the operator comes first. Normal notation (e.g., a + b) is called "infix" notation because the operator is between or within the expression. /z/setmatrix load def /t/translate load def /S/scale load def /g/gsave load def /G/grestore load def /H/setgray load def Chapter 2 PostScript 5/5/00 12:52 PM Page 36 2 It All Started with PostScript 37

Then the position and copy are set: The default measurement system in both PostScript and PDF is in units of 1/72 of an inch. The starting point is in the lower-left corner of the page or drawing area. An 8.5x11" inch page is 612 units horizontally and 792 units vertically-- just like graph paper. PDF objects are a construct that the PostScript Language does not have. The ability to randomly access portions of a PDF document and the page independence of PDF pages are based on the object structuring of PDF.

Color space resources are often called color "profiles." This terminology has been promoted by the International Color Consortium or ICC. The color-space resources in PDF and PostScript serve the same function and are roughly equivalent to ICC profiles. They aren't literally the same but contain the same or equivalent information. It is easy to convert from a PDF color space resource to an ICC profile and the other way as well. Most color management systems consider color spaces as being derived from and belonging to color devices. The material in this PDF file is associated with two devices, one L*a*b* and one an RGB device. Most color-management discussion and color-management software consider a whole job to be in one color space. This is a mistake that Adobe PostScript and PDF do not make. Any material in either language can be specified with respect to any color space. The objects can refer or point to one another to form complex relationships and data structures. Streams of arbitrary unstructured data can be defined. The cross-reference table that occurs at the end of the PDF file allows programs to read selected objects out of the file at arbitrary positions. The objects don't have be in any particular order or place within the file. The cross-reference table determines where each object has ended up in the file. This notation is powerful enough to represent many other kinds of structured data beside a PDF document. In fact, Adobe has begun to use the notation for at least two other purposes: one for FDF files to hold the field name, field value pairs that result from filling in an Acrobat Form, and the second which is the PJTF or Portable Job Ticket Format used to control the workflow and post-processing. PDF files require that they have a /Root that points to a /Catalog that points to a /Pages object that points to the documents pages. Not all uses of this notation should have to follow those document rules. In fact, both the FDF and the PJTF do not. So to be perfectly logical, each of PDF, FDF, and PJTF are using a notation and specializing it for their particular needs. Dr. Jim King has coined the term SDF or Structured Data Format for the general use of this notation and reserve PDF for the specialization having to do with representing documents in this particular way. Thus, this diagram.

43 533.53 m 3.02 -.18 2 19.3 (RIP)d 67.39 h 3.02 -.18 23 101.5 (is just a little bit dif)d 179.48 h 3.02 -.18 2 14.48 (fer)d 193.2 h 3.02 -.18 11 67.38 (ent. Many ar)d 264.25 h (e)M 43 548.16 m 1.55 -.18 8 50.33 (based on )d 266.01 h (-)M 43 562.79 m 0 -.18 12 65.04 (tional featur)d 105.49 h 0 -.18 14 81.86 (es, and some ar)d 184.43 h 0 -.18 16 88.46 (e legally derived)d 43 577.42 m 2.59 -.18 1 8.73 (fr)d

No comments:

Post a Comment