Search all of Office.com
 
Support / Word / Word 2003 Help and How-to / Automating Tasks and Programmability / Field Types and Switches / Field Reference
 
 

Embedding PostScript printer commands in a Word document

Applies to: Microsoft Office Word 2003

 

You can send PostScript programming strings to your printer by inserting PRINT fields in the document text. Microsoft Word sends the commands to the printer as native PostScript codes. PostScript commands embedded (embed: To insert information created in one program, such as a chart or an equation, into another program. After the object is embedded, the information becomes part of the document. Any changes you make to the object are reflected in the document.) in your document are carried out in the order in which you insert them. Use the following syntax:

{ PRINT \p Group "Codes" }

The y-coordinate space used for PostScript commands in Word is the same as for normal PostScript. The graphics origin (0,0) is in the lower-left corner of the page, and the positive directions are up and to the right. PostScript drawing instructions take place within a drawing rectangle. The graphics origin is translated to the lower-left corner of the drawing rectangle.

ShowInstructions

\p Group

Defines the drawing rectangle that the subsequent PostScript instructions operate on.

ShowCommands

PostScript drawing commands specified in a PRINT field operate only on the drawing rectangle that's defined by one of the group commands listed here.

page

Defines the drawing rectangle as the current page (default).

para

Defines the drawing rectangle as the paragraph that contains the PRINT field. The paragraph must be at least 1 inch tall for "para" to produce a result.

pic

Defines the drawing rectangle as the next picture after the PRINT field but before the end of the paragraph that contains the field.

Row

Defines the drawing rectangle as the current table row.

Cell

Defines the drawing rectangle as the current table cell.

Show"Dict" group command

Use the "dict" group command to create a PostScript group that contains definitions and procedures that will be carried out later on the same page. Don't use the "dict" command to draw. Microsoft Word doesn't provide "wp$" variables for "dict" groups, nor does it change the drawing origin, clipping, and axes.

 Note   Because Word text and graphics are printed on the same PostScript page as your PostScript commands, don't use operators (operator: A sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison, logical, and reference operators.) that reset the PostScript environment. Avoid the following operators when using PostScript with Word: banddevice, copypage, framedevice, grestoreall, initgraphics, initmatrix, nulldevice, renderbands, and showpage.

ShowVariables

Word also defines variables for use with the PostScript commands specified in a PRINT field. Values represented by the variables are in points, which is the standard PostScript unit.

ShowVariables for all groups

The following variables are available to all groups of PostScript commands.

wp$y

Specifies the drawing height of the page, paragraph, row, or cell that the PRINT field is located in, depending on the Group argument (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.) used. If the "\p pic" argument is used, "wp$y" refers to the drawing height of the next picture before the end of the paragraph that contains the PRINT field.

wp$x

Specifies the drawing width of the page, paragraph, row, or cell that the PRINT field is located in, depending on the Group argument used. If the "\p pic" argument is used, "wp$x" refers to the drawing width of the next picture before the end of the paragraph that contains the PRINT field.

wp$page

Specifies the current page number.

wp$fpage

Specifies the formatted page number (string).

wp$date

Specifies the current date (formatted).

wp$time

Specifies the current time (formatted).

wp$box

Specifies the path (path: The route that the operating system uses to locate a folder or file; for example, C:\House finances\March.doc.) that contains the drawing rectangle.

ShowVariables for "page" and "para" groups

The following variables are available to both "page" and "para" groups.

wp$top

Specifies top margin (page); space before (paragraph).

wp$bottom

Specifies bottom margin (page); space after (paragraph).

wp$left

Specifies left margin (page); left indent (paragraph).

wp$right

Specifies right margin (page); right indent (paragraph).

The following variables are available to the "para" group only.

wp$first

Specifies first-line indent.

wp$style

Specifies style (style: A combination of formatting characteristics, such as font, font size, and indentation, that you name and store as a set. When you apply a style, all of the formatting instructions in that style are applied at one time.).

The following variables are available to the "page" group only.

wp$col

Specifies the number of columns on the page. The number can vary, depending on the section (section: A portion of a document in which you set certain page formatting options. You create a new section when you want to change such properties as line numbering, number of columns, or headers and footers.) that the PostScript appears in.

wp$colx

Specifies the width of each column.

wp$colxb

Specifies the space between columns.

"Codes"

PostScript instructions. If the instructions contain more than one word, enclose them in quotation marks.

 Notes 

  • To print PostScript over text, click the Options command on the Tools menu, click the Print tab, and then select the Print PostScript over text check box.
  • For complete information about the PostScript programming language, see the PostScript Language Reference Manual and the PostScript Language Tutorial and Cookbook, both by Adobe Systems, Inc., and published by the Addison-Wesley Publishing Co., Inc.