Using Xerox postscript PDL commands in Word 2003 to control printer function?

R

RobatPF

Question from the postscript uninitiated!.............

We currently have a lot of templates with code written to control a
number of primary functions such as Tray and Duplex, but it only works
via the PCL drivers for our Xerox printers. We are missing a lot of
functionality as well as having a lot of problems with other
applications printing effectively. We want to use the postscript
drivers for our printers and be able to pass postscript PDL commands as
per the PDL reference for each printer. I have tried using the PRINT
\p page field, but the commands do not execute or the printer prints
error pages. If anyone can help with code or point me in the right
direction it would be greatly appreciated.
 
D

Doug Robbins - Word MVP

See:

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116

Controlling the Printer from Word VBA
Part 3: Dealing with Different Paper Sizes
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132

Controlling the Printer from Word VBA
Part 4: Getting printer driver details
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=183


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

RobatPF

Thanks very much for the pointers for this. I have retreived the code
samples and are using them to get some of what I wanted to work.

Two questions though, how can I check capabilites of a printer without
necessarily knowing them and I need to be able tp staple but cannot
work out how to turn on or control that parameter. What I mainly need
to know is how to get other printer properties from the API / Printer
Driver and then set them as required.

Regards.
 
M

macropod

Hi Robat,

The following PRINT field coding uses postscript code I found on a website
to return the printer's media capabilities:

{PRINT \p page " % Print the InputAttributes dictionary for a printer, to
see what media it thinks it has.

erasepage %% hide the above instructions
clippath flattenpath pathbbox %% Bounding box of current page
/ury exch def
/urx exch def
/lly exch def
/llx exch def
/width urx llx sub def %% Width of current page
/height ury lly sub def %% Height of current page
/Depth 0 def %% Nesting depth of composite objects
/FStr 256 string def %% Scratch string

/Courier findfont 12 scalefont setfont %% Select a guaranteed font @ 12
point
llx 10 add ury 15 sub moveto %% Move to top left corner

/DownOneLine
{
currentpoint exch pop %% Get the current point, discard x co-ordinate
15 sub %% Move down one line
dup 15 lt{ %% Have we enough space to draw the next line?
pop %% If no, discard the y co-ordinate
showpage %% Show the page so far
ury 30 sub %% Start from the top of the next one
}if
llx 10 add exch %% And back to the start of the line
moveto
}bind def

/dumparray
{
/Depth Depth 1 add def
([) show
0 1 Depth { pop ( ) show} for
{
dup type /dicttype eq{
dumpdict
}{
dup type /arraytype eq{
dumparray
}{
dup type /stringtype eq{
(<) show
show
(>) show
DownOneLine
}{
dup type /nametype eq{
(/)show
DownOneLine
}if
FStr cvs show
}ifelse
}ifelse
} ifelse
( ) show
} forall
/Depth Depth 1 sub def
0 1 Depth {( ) show} for
(]) show
}bind def

/dumpdict
{
0 1 Depth {pop ( ) show} for
/Depth Depth 1 add def
(<<) show
DownOneLine
{
%% swap key/value, and output key
exch
0 1 Depth { pop ( ) show} for
(/) show
FStr cvs show
( ) show
dup type /dicttype eq{
dumpdict
}{
dup type /arraytype eq{
dumparray
}{
dup type /stringtype eq{
(\() show
show (\)) show
}{
dup type /nametype eq{
(/) show
}if
FStr cvs show
}ifelse
}ifelse
}ifelse
DownOneLine
} forall
/Depth Depth 1 sub def
0 1 Depth {( ) show} for
(>>) show
DownOneLine
}bind def

/PD currentpagedevice def %% Get current page device

systemdict /languagelevel known %% check at least Level 2
{
PD /InputAttributes known %% Check for presence of InputAttributes
dictionary
{
PD /InputAttributes get %% Get the InputAttributes dictionary
dumpdict %% dump the contents
}
{(Interpreter has no InputAtrributes dictionary in the page device) show}
ifelse
}
{(Interpreter is Level 1 and does not support InputAtrributes) show}
ifelse

"}

Note that the first "{" and last "}" are the field braces created via
Ctrl-F9 - the rest are plain text. Using the Adobe postscript manuals, you
should be able to modify the code to test for stapling, duplexing etc,
capabilities.

Cheers
 

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