Microsoft KB Archive/47057

Word: How to Print a Page Number Sideways PSS ID Number: Q47057 Article last modified on 02-01-1993 PSS database name: M_WorD

3.00 3.01 3.02 4.00 5.00 5.10

MACINTOSH

Summary:

In Microsoft Word for the Macintosh, you can print a page number sideways (at a 90-degree angle from the rest of the document’s orientation) by inserting PostScript commands. The easiest way to insert these PostScript commands is to use Glossary entries provided by Microsoft.

Word Version 5.0 and 5.1
The needed glossary entry, “Rotate Landscape Page Numbers,” is found in the Page Layout Glossary. It allows you to print a sideways page number at the upper middle, upper right, bottom middle, or bottom right of your document. The PostScript code included in the glossary entry follows:

0 0 moveto /Times-Roman findfont 12 scalefont setfont /StrLength {(page ) stringwidth pop wp$fpage stringwidth pop add} def

/PointsFromRight {36} def /PointsFromTop {42} def /PointsFromBottom {42} def

/UpperMiddle {wp$x PointsFromTop sub wp$ y 2 div StrLength 2 div add} def /UpperRight {wp$x PointsFromTop sub wp$ yorig PointsFromRight add StrLength add} def /BottomMiddle {wp$xorig PointsFromBottom add wp$ y 2 div StrLength 2 div add} def /BottomRight {wp$xorig PointsFromBottom add wp$ yorig PointsFromRight add StrLength add} def

% MANDATORY: Delete the first percent sign from ONE of the % following 4 lines of code to have the page number print in % the corresponding corner: UpperMiddle moveto %UpperRight moveto %BottomMiddle moveto %BottomRight moveto

270 rotate (Page ) show wp$fpage show

You must specifiy the exact location of the page number by slightly altering the postscipt code. The instructions for doing this are included in the postscript code, beginning on the line that begins with “%MANDATORY” (without quotation marks).

Word Version 4.0 and 3.x
In Microsoft Word versions 3.0, 3.01, 3.02, and 4.0, you can print a page number sideways (at a 90-degree angle from the rest of the document’s orientation) by inserting PostScript commands.

The PostScript Glossary on the Word 4.0 Utilities 2 disk (Word 3.x Utilities disk) contains a glossary entry called “sideways page #” that achieves the effect of printing a sideways page number in the bottom-right corner of the page. The PostScript code is as follows:

% draws the current page sideways against the bottom-right margin wp$x wp$ right sub wp$bottom moveto %find x- and y-coord 90 rotate %rotate perspective 90 deg  /Times-Roman findfont 30 scalefont setfont %set and scale font  (Page ) show wp$ fpage show %print the strings

To print the page number sideways elsewhere on the page, you must modify the “moveto” statement in the second paragraph of the inserted glossary entry text.

For example, to achieve the effect of printing a sideways page number in the bottom-left corner of the page, use the following lines of PostScript:

% draws the current page sideways against the bottom-left margin wp$left wp$ bottom moveto %find x- and y-coord 90 rotate %rotate perspective 90 deg /Times-Roman findfont 30 scalefont setfont %set and scale font (Page ) show wp$fpage show %print the strings

For another example, to achieve the effect of printing a sideways page number centered along the right edge of the page, use the following lines of PostScript:

% draws the current page sideways against the center right margin /Times-Roman findfont 30 scalefont setfont %set and scale font wp$x wp$ right sub %find x-coord wp$y %start to find y-coord... (Page ) stringwidth pop %width of "Page " string wp$ fpage stringwidth pop %width of page num string add %add stringwidths together sub %sub total stringwidth %from wp$y  2 div %div by 2 to find y-coord  %x and y now on stack  moveto %moveto (x,y)  90 rotate %rotate perspective 90 deg  (Page ) show wp$ fpage show %print the strings

Note: To print at 270 degrees (down the page) instead of 90, add the total stringwidths to wp$y instead of subtracting as done in the example. Everything else would remain the same. Also note that in this last case, the font must be set and scaled before the coordinates are found; otherwise, the string will not be centered correctly.

More Information:

For more information about using Postscript in Word, see the “Microsoft Word User’s Guide,” version 5.0, pages 771- 780.

Additional reference words: 3.00 4.00 5.00 5.10

Copyright Microsoft Corporation 1993.