Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Printing and Fonts / December 2004

Tip: Looking for answers? Try searching our database.

How do I use the PRINT field code to . . .

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 09 Dec 2004 19:19 GMT
I am using Word 2003 on Windows XP and I am trying to figure out how to use
the PRINT field code.  My ultimate goal is to embed postscript/pdfmark code
to pass to the PDFMaker utility, which creates PDF files from Word documents.
I have experience using field codes and I have read the documentation for
the PRINT field code.  My issue is with the /p para group flag for the PRINT
field code.  I either have misunderstood the documentation, or the feature
is not
working as advertised.  I will illustrate with a simple example.  Consider a
simple document with only one paragraph and using the PRINT field code to
print text over the paragraph as in this example:

The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over
the lazy dog.  The quick brown fox jumps over the lazy dog.  The quick brown
fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over
the lazy dog.  The quick brown fox jumps over the lazy dog.  The quick brown
fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.
{PRINT \p para "wp$x 2 div wp$y 2 div moveto 45 rotate /Helvetica findfont 12
scalefont setfont 0.5 setgray (hello) show "} The quick brown fox jumps over
the lazy dog.  The quick brown fox jumps over the lazy dog.

I expected this to produce the word "hello" printed at a 45 degree angle
over the center of the paragraph — instead only the regular text appears with
no discernable effect of the PRINT field code. I have also tried using the
"page" instead of the "para" group with success, but I really need to figure
out  how to use the "para" group.

Thanks in advance for any help.
greg.mouning@yale.edu - 11 Dec 2004 00:51 GMT
Hi Dave,

According to my the Word 2000 help documentation:

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

Try creating more text...

HTH,
Greg
> I am using Word 2003 on Windows XP and I am trying to figure out how to use
> the PRINT field code.  My ultimate goal is to embed postscript/pdfmark code
[quoted text clipped - 19 lines]
> I expected this to produce the word "hello" printed at a 45 degree angle
> over the center of the paragraph - instead only the regular text
appears with
> no discernable effect of the PRINT field code. I have also tried using the
> "page" instead of the "para" group with success, but I really need to figure
> out  how to use the "para" group.
>
> Thanks in advance for any help.
Dave - 13 Dec 2004 14:07 GMT
Greg,

First, thank you for attempting to help.  Unfortunately, it does not matter
how big the paragraph containing the PRINT field code with the "/p para"
switch is — the postscript code snippet "wp$x 2 div wp$y 2 div moveto 45
rotate /Helvetica findfont 12 scalefont setfont 0.5 setgray (hello) show "
does not yield a visible result on the printed page.  However, I looked at
the raw Postscript file and found the following code (produced by the PRINT
field code) embedded in the file:

Pscript_WinNT_Compat begin /$x mysetup def end
/Pscript_WinNT_Full /ProcSet findresource dup /suspend get exec
%%BeginDocument: Pscript_Win_PassThrough
gsave
initgraphics
88472 -246329 translate
/wp$xorig 88472 def
/wp$yorig -246329 def
/wp$y 176342 def
/wp$x 424676 def
/wp$page 1 def
/wp$fpage (1) def
/wp$date (12/13/2004) def
/wp$time (8:38 AM) def
/wp$box { newpath 0 0 moveto wp$x 0 rlineto 0 wp$y rlineto wp$x neg 0
rlineto closepath } def
wp$box clip newpath
/wp$style (N) def
/wp$top 0 def
/wp$bottom 0 def
/wp$left 0 def
/wp$first 0 def
/wp$right 0 def
wp$x 2 div wp$y 2 div moveto 45 rotate /Helvetica findfont 12 scalefont
setfont 0.5 setgray (hello) show
grestore

So, in fact the PRINT field code is producing postscript code, but the
definitions of wp$xorig, wp$yorig, wp$x and wp$y seem a bit "wacky".  Why is
it necessary to translate the origin to 88472,-246329?  The problem is that
the origin and coordinates result in the desired text  being off the visible
page.

In contrast, if I use the "/p page" switch in the PRINT field code, the
following postscript code is produced:

Pscript_WinNT_Compat begin /$x mysetup def end
/Pscript_WinNT_Full /ProcSet findresource dup /suspend get exec
%%BeginDocument: Pscript_Win_PassThrough

gsave
initgraphics
/wp$xorig 0 def
/wp$yorig 0 def
/wp$y 792 def
/wp$x 612 def
/wp$page 1 def
/wp$fpage (1) def
/wp$date (12/13/2004) def
/wp$time (8:38 AM) def
/wp$box { newpath 0 0 moveto wp$x 0 rlineto 0 wp$y rlineto wp$x neg 0
rlineto closepath } def
wp$box clip newpath
/wp$top 72 def
/wp$bottom 72 def
/wp$left 90 def
/wp$right 90 def
/wp$col 1 def
/wp$colx 432 def
/wp$colxb 0 def
wp$x 2 div wp$y 2 div moveto 45 rotate /Helvetica findfont 36 scalefont
setfont 0.5 setgray (hello) show
grestore

This produces the desired result — the word "hello is printed at 45 degrees
in gray at the center of the page.  In addition, the values of wp$xorig,
wp$yorig, wp$x, and wp$y make sense — for a 8 1/2 x 11 page with 72 points
per inch the page width is 612 and the page height is 792.

Again, the result was obtained using Word 2003.  It would be really
interesting to see if previous versions of Word produced identical results,
but I do not have easy access to other Word versions.

Any additional thoughts or advice?

> Hi Dave,
>
[quoted text clipped - 55 lines]
> >
> > Thanks in advance for any help.
Jezebel - 14 Dec 2004 07:53 GMT
I've never managed to get Print codes to do anything at all. Apart from the
problem with numeric values that Word is providing, by putting your print
instructions withing a gsave....grestore construct means that your
instruction is discarded anyway.

> Greg,
>
[quoted text clipped - 71 lines]
>
> This produces the desired result - the word "hello is printed at 45
degrees
> in gray at the center of the page.  In addition, the values of wp$xorig,
> wp$yorig, wp$x, and wp$y make sense - for a 8 1/2 x 11 page with 72 points
[quoted text clipped - 65 lines]
> > >
> > > Thanks in advance for any help.
Dave - 14 Dec 2004 13:43 GMT
The only problem I've had with PRINT field code in MS Word has occurred when
I use the \p para switch.  With regard to the gsave, initgraphics, and
grestore Postscript operators see any reference on the Postscript Language,
or refer to these brief notes
http://www.eecs.tufts.edu/g/15/notes/adv_postscript — my point is that they
are necessary and your conclusion that they result in discarding the code
passed by the PRINT field code is wrong.

Also, I found this reference today about the use of the PRINT field code
with Word 97 and 2002
http://www.talkaboutprogramming.com/group/comp.lang.postscript/messages/92156.html
The author of the message observed that PRINT field codes using the \p para
switch worked in Word 97, but broke in Word 2002. It seems to me as though
there was a change in Word after 97 that broke the \p para switch, or the
implementation changed but the documentation for PRINT wasn't updated.

Here is another observation - the coordinates in the Postscript code
produced in my example that used the \p para seem to be related to page
coordinates in inches by a factor of 72000. I say this because wp$x is
424676, wp$y is 176342 and the width and height of my paragraph are roughly
2.45 by 5.9 inches.  My page also has top and bottom margins of  1.0 inches
and left and right margins of 1.25 inches.

Finally, my example illustrating the problem with the \p para switch for
PRINT was made using Word 2003 on Windows XP Professional by:
1.  Creating a new blank document (shortcut: Ctrl+N).
2.  type:
=rand(1,24)
the hit enter key. This generates a paragraph containing 24 instances of the
sentence "The quick brown fox jumps over the lazy dog."
3.  Move the insertion point to a point somewhere in the new paragraph text.
4.  Insert the PRINT field code:
    a. Ctrl+F9   (inserts an empty field code)
    b.  type:
PRINT \p para "wp$x 2 div wp$y 2 div moveto 45 rotate /Helvetica findfont 12
scalefont setfont 0.5 setgray (hello) show"
5.  Check the result by printing the Word document to your Postscript
printer. Also, print the document to a Postscript file, i.e. Ctrl+P (opens
Print dialog); select a Postscript Printer; check the "Print to File"
checkbox; and hit OK.  Examine the resulting Postscript file with a text
editor.
6.  Repeat steps 1-5 except replace "\p para" with "\p page" in step 4.

Thank you.

> I've never managed to get Print codes to do anything at all. Apart from the
> problem with numeric values that Word is providing, by putting your print
[quoted text clipped - 152 lines]
> > > >
> > > > Thanks in advance for any help.
greg.mouning@yale.edu - 15 Dec 2004 04:09 GMT
Dave,

Doubt this is much help to you but after reading your posts, I thought
I'd try using a version of Word 97 to see if it would print a rotate
hello using the "/para" switch. Unfortunately, that didn't work either.
Good luck!
-Greg
Dave - 15 Dec 2004 12:31 GMT
Greg,

Would you mind posting what PostScript was produced when you used Word 97?  
Specifically, would you post the snippet of code between the lines
"%%BeginDocument: Pscript_Win_PassThrough" and "%%EndDocument:
Pscript_Win_PassThrough"? I just want to see if there has been any change in
the PostScript coordinate transformations produced by Word between 97 and
2002+.

Thank you.
Dave

> Dave,
>
[quoted text clipped - 3 lines]
> Good luck!
> -Greg
Greg - 15 Dec 2004 21:43 GMT
Ok Dave, I'll try posting the generated PS code but, I don't see references
to "%%BeginDocument: Pscript_Win_PassThrough" in my generated PS file. Do you
have an FTP site where I can temporarily upload the file?

Also,  FYI in my previous version of Word97 I was unsuccessful in getting
the "/page" or "/para" parameter to work. Whereas, in my current version of
Word 2000 I was only successful in getting the  "/page" parameter to work..

Regards,
Greg

> Greg,
>
[quoted text clipped - 15 lines]
> > Good luck!
> > -Greg
Dave - 17 Dec 2004 12:23 GMT
Greg,

I do not have an FTP site.

How did you generate the PostScript file from Word?

Dave

> Ok Dave, I'll try posting the generated PS code but, I don't see references
> to "%%BeginDocument: Pscript_Win_PassThrough" in my generated PS file. Do you
[quoted text clipped - 26 lines]
> > > Good luck!
> > > -Greg
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.