How-To embed POSTSCRIPT Commands into Word Doc

  • Thread starter George-of-the-Jungle
  • Start date
G

George-of-the-Jungle

In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page“
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore strokeâ€} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p paraâ€wp$box .95 setgray fillâ€} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page “commandsâ€}

Printer is HP LaserJet 5 SI MX
 
J

John McGhie [MVP - Word and Word Macintosh]

Insert>Fields>All Fields>"PRINT"

The old PRINT field is still there. Insert it, then add the PostScript you
want within it.

It'll work :)


In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page³
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore stroke²} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p para²wp$box .95 setgray fill²} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page ³commands²}

Printer is HP LaserJet 5 SI MX

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
G

George-of-the-Jungle

G'Day John,

Thank you. It does work. I found I also need to set my Tools> Options >
"View" tab > and select "Field Codes" in order to display them in the
document for editing/correcting. (Typos make a difference).
--
George V KP.org


John McGhie [MVP - Word and Word Macinto said:
Insert>Fields>All Fields>"PRINT"

The old PRINT field is still there. Insert it, then add the PostScript you
want within it.

It'll work :)


In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page³
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore stroke²} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p para²wp$box .95 setgray fill²} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page ³commands²}

Printer is HP LaserJet 5 SI MX

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
W

Wayne

I am trying to do something similar with Word 2007, but it appears the x/y
numbers being generated are incorrect for Cell, Row, and Para. Page appears
to generate correctly. Setting a parmeter in Word options for 'Use printer
metrics to lay out document', improved the results (incorrect position, but
now at least on the page). Is there another parmeter I need to set to have
numbers generate properly, or is there a known bug that I must wait on a fix
for? Thanks in advance.

George-of-the-Jungle said:
G'Day John,

Thank you. It does work. I found I also need to set my Tools> Options >
"View" tab > and select "Field Codes" in order to display them in the
document for editing/correcting. (Typos make a difference).
--
George V KP.org


John McGhie [MVP - Word and Word Macinto said:
Insert>Fields>All Fields>"PRINT"

The old PRINT field is still there. Insert it, then add the PostScript you
want within it.

It'll work :)


In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page³
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore stroke²} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p para²wp$box .95 setgray fill²} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page ³commands²}

Printer is HP LaserJet 5 SI MX

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
M

macropod

Hi Wayne,

Perhaps you could explain what you're trying to do. I find your reference to "it appears the x/y numbers being generated are
incorrect for Cell, Row, and Para" somewhat cryptic. How does all this relate to using a PRINT field to output postscript?

--
Cheers
macropod
[MVP - Microsoft Word]


Wayne said:
I am trying to do something similar with Word 2007, but it appears the x/y
numbers being generated are incorrect for Cell, Row, and Para. Page appears
to generate correctly. Setting a parmeter in Word options for 'Use printer
metrics to lay out document', improved the results (incorrect position, but
now at least on the page). Is there another parmeter I need to set to have
numbers generate properly, or is there a known bug that I must wait on a fix
for? Thanks in advance.

George-of-the-Jungle said:
G'Day John,

Thank you. It does work. I found I also need to set my Tools> Options >
"View" tab > and select "Field Codes" in order to display them in the
document for editing/correcting. (Typos make a difference).
--
George V KP.org


John McGhie [MVP - Word and Word Macinto said:
Insert>Fields>All Fields>"PRINT"

The old PRINT field is still there. Insert it, then add the PostScript you
want within it.

It'll work :)


On 8/2/07 4:05 AM, in article
(e-mail address removed), "George-of-the-Jungle"

In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page³
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore stroke²} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p para²wp$box .95 setgray fill²} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page ³commands²}

Printer is HP LaserJet 5 SI MX




--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
P

Peter Jamieson

Do you mean when you use the \p cell, \p row, \p para options?

I'm not sure Word 2007's online help provides the full online help for
PRINT (and even that is barely adequate) - it may be worth having a look
here:

http://office.microsoft.com/en-us/word/HP051861821033.aspx

Peter Jamieson

http://tips.pjmsn.me.uk
I am trying to do something similar with Word 2007, but it appears the x/y
numbers being generated are incorrect for Cell, Row, and Para. Page appears
to generate correctly. Setting a parmeter in Word options for 'Use printer
metrics to lay out document', improved the results (incorrect position, but
now at least on the page). Is there another parmeter I need to set to have
numbers generate properly, or is there a known bug that I must wait on a fix
for? Thanks in advance.

George-of-the-Jungle said:
G'Day John,

Thank you. It does work. I found I also need to set my Tools> Options >
"View" tab > and select "Field Codes" in order to display them in the
document for editing/correcting. (Typos make a difference).
--
George V KP.org


John McGhie [MVP - Word and Word Macinto said:
Insert>Fields>All Fields>"PRINT"

The old PRINT field is still there. Insert it, then add the PostScript you
want within it.

It'll work :)


On 8/2/07 4:05 AM, in article
(e-mail address removed), "George-of-the-Jungle"

In previous versions of WORD, (Mac version) you could enter postscript
commands within a doc and get the commands processed while the text printed
also.
How in Word 2003 (PC) can you do the same - An example would be great.

This is my test.doc which does not print any postscript with the text. The
same print will do if I use my old Mav Word v 5a:

# <this part is "hidden">
{PRINT \p page³
/inch {72 mul} def
/Helvetica-Bold findfont 150 scalefont setfont
3.0 inch 2.5 inch moveto
0 setlinewidth
57.0 rotate (COPY) true charpath
gsave .95 setgray fill grestore stroke²} # <following line is not hidden>
--------- Begin TEST ---------
{PRINT \p para²wp$box .95 setgray fill²} # <this line is hidden>

testing Postscript Format and commands {PRINT\p page ³commands²}

Printer is HP LaserJet 5 SI MX



--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
W

Wayne

I am creating a PDFmark to create a PDF text box in the resulting PDF file.
I have done this in a previous version of Word and Acrobat. I am using
'print \p cell "[/T (Ship_To_Name) /Subtype /Widget /FT /Tx /DV (No Ship To
Name) /Rect [ wp$box pathbbox] /F 4 /BS << /S /S /W 1 >> /MK << /BC [ 1 0 0 ]
/BG [ 1 1 1 ] >> /ANN pdfmark"'. I get a text box that is incorrectly
positioned. It is at the top of the page, instead of in the table cell
(incorrect y values) and shifted to the left (incorrect x position). Before
I set the option for printing metrics, some of the resulting numbers in the
intermediate PostScript code were negative numbers (off the page). We I
tested with page verses cell, I got a text box the size of the page.

macropod said:
Hi Wayne,

Perhaps you could explain what you're trying to do. I find your reference to "it appears the x/y numbers being generated are
incorrect for Cell, Row, and Para" somewhat cryptic. How does all this relate to using a PRINT field to output postscript?

--
Cheers
macropod
[MVP - Microsoft Word]


Wayne said:
I am trying to do something similar with Word 2007, but it appears the x/y
numbers being generated are incorrect for Cell, Row, and Para. Page appears
to generate correctly. Setting a parmeter in Word options for 'Use printer
metrics to lay out document', improved the results (incorrect position, but
now at least on the page). Is there another parmeter I need to set to have
numbers generate properly, or is there a known bug that I must wait on a fix
for? Thanks in advance.
 
W

Wayne

Peter,

Thank you. I had found this entry previously. This is process I am trying
to use. I also noted this on-line documentation is for Word 2003.
 
P

Peter Jamieson

Unfortunately, all I can do is confirm exactly the same experience.
(I've never used this stuff for PS work).

The following article suggests the same problem and solution in Word 2000:

http://support.microsoft.com/kb/220214

With \p para (I didn't check \p cell) and "use printer metrics" set,
Word sets the bottom left hand corner of the paragraph to be the origin
(in points), and in effect defines the x-coordinate of the left side and
the y-coordinate as having the same coordinates as the origin, then
defines the width and height of the box containing the paragraph

However, without "use printer metrics" set, Word 2007, 2003 and 2000
a. use a different unit altogether to define the offset; in some cases
(2003, I think) the numbers are (more or less) 1000 times the values in
points, and in others (2007 and 2000) they seem to be around 500 times.
b. use a negative value for the y-offset, which seems simply wrong to me.

Although in some cases I /think/ the rectangle defined would be the
correct rectangle, but 500 or 1000 times too large, I'm not too sure
about that.

I would guess from the article quoted above that this works in Word 97
regardless of the "use printer metrics" setting, but I wasn't able to
test that. In Word 95 it seems to work either way.

I wondered whether Word was relying on some scaling factor to scale
these coordinates back to points (or some such adjustment). I couldn't
spot any such thing, but I can't say I know postscript well enough to do
that.

As long as the "use printer metrics" approach works, I guess you're OK.
Otherwise, I think you would probably have to add some fudge factors
into the Postscript code (e.g. to divide all the variables set by Word
by 500 or 1000, and make any other adjustments necessary).

I tried checking "Print Postscript over text" but that does not appear
to affect this.

Peter Jamieson

http://tips.pjmsn.me.uk
 
W

Wayne

Peter,

Thank you for your time.

One of the things I have learned about this process is that in previous
versions of Word, you had to set the unit of measure to points (from inches)
to have the generated PostScript come out in points. Otherwise, you got
those high numbers that appear to be 500 to 1000 times to big. This appears
to be changed in Word 2007, as I tested both points and inches, and the
numbers in the resulting PostScript code appear to be in points. There does
not appear to be any scaling.

The PostScript code that is generated does have commands for a temporary new
x,y position to draw the 'box'. This is the same as older versions of Word,
except now, the numbers (x,y) appear to be incorrect. The pattern for
options other than '\p page' appear to give a y value of the hieght of the
page minus the height of the 'box' (cell, row, pic, para). This shows up in
the PostScript translate command and the temporary PostScript variable
wp$yorig. The only pattern I see for the x value is it is less than desired.

I have tested this with the PostScript code generated by Adobe Acrobat 9 and
a separate PostScript print drive. Same results for both.

I also tested the 'PostScript over Text' option, and it made no difference.

At this point, it appears to be Word 2007 generating incorrect information.
Anyone know the proper process to submit a 'bug' to MicroSoft without having
to go thru the 'pay us for the privilege to submit a bug' process that all
the MicroSoft web pages seem to route you to?
 
P

Peter Jamieson

Anyone know the proper process to submit a 'bug' to MicroSoft without having
to go thru the 'pay us for the privilege to submit a bug' process that all
the MicroSoft web pages seem to route you to?

I do not know if this is the "best" method to report a problem, but IMO
it is probably worth submitting an e-support incident, if that mechanism
is available in your region. In the USA, for example, (not my region!)
if you can get to

http://support.microsoft.com/select/default.aspx?target=assistance

then click the following link near the bottom

Contact a support professional by E-mail, Online, or Phone

On the next page, click "Word 2007" in the list of products (don't click
the "contact a support professional link in the top right of the page -
it gets you no further)

Then you have to respond to a couple of questions before you get to
their explanation of eligibility. Personally I would try to go through
that even if not eligible on the grounds that I am not asking for
support but reporting an error. But you may or may not be able to do that.

I have been through various support processes with MS and none of them
has been an entirely helpful experience. All I can suggest is that
a. you prepare your material/case well, and copy pre-prepared text
into any web-based submission forms rather than typing it in.
b. you spell out the details of the problem in terms that someone who
knows little or nothing about Word, fields, the PRINT field, postscript,
pdf or pdfmarks can follow. A good set of "steps to reproduce" would be
particularly important in this case. Using a PRINT field that shows a
really obvious result (e.g. a visile bounding box) might be a good idea.
c. if you think being able to insert a pdfmark is a widely-required
feature that MS should pay attention to, say so (you could even suggests
that they try to implement it in the "save to PDF" feature). At theis
point I suspect that if MS were to do anything, they would implement it
as a new feature within "content controls" rather than try to fix the
existing field. But that's nothing more than speculation on my part.

What MS will do with your submission is anyone's guess. If it's a
significant problem faced by a lot of people, a fix is more likely,
particularly if the cause is easily discovered /and/ the risk of adverse
side effects appears low. Some things I (and doubtless others) have
reported have been fixed quickly/after about 18 months/never.


Peter Jamieson

http://tips.pjmsn.me.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top