Discussion:
what does this mean, "{ /Duplex true def } if"
(too old to reply)
Thomas Gagne
2010-04-20 19:57:50 UTC
Permalink
I don't know how to read PS yet, and so I'm confused about the code below.

Under what circumstances will duplex be true in the code below? Also,
will pdfSetup need to be invoked each time to set duplex for each page?
Once duplex is turned on, are all pages following duplexed until I turn
it off?

/pdfSetup {
3 1 roll 2 array astore
/setpagedevice where {
pop 3 dict begin
/PageSize exch def
/ImagingBBox null def
/Policies 1 dict dup begin /PageSize 3 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop pop
} ifelse
} def
Helge Blischke
2010-04-20 20:14:49 UTC
Permalink
Post by Thomas Gagne
I don't know how to read PS yet, and so I'm confused about the code below.
Under what circumstances will duplex be true in the code below? Also,
will pdfSetup need to be invoked each time to set duplex for each page?
Once duplex is turned on, are all pages following duplexed until I turn
it off?
/pdfSetup {
3 1 roll 2 array astore
/setpagedevice where {
pop 3 dict begin
/PageSize exch def
/ImagingBBox null def
/Policies 1 dict dup begin /PageSize 3 def end def
{ /Duplex true def } if
currentdict end setpagedevice
} {
pop pop
} ifelse
} def
This code snippet is part of a PS file converted from a PDF file by the
pdftops utility that comes with xpdf. This PS procedure is called just
preceding the code of the first page with 3 parameters - the page dimensions
and a flag that determines duplex or not, e.g.

595 842 false pdfSetup

specifying an A4 page and simplex printing.

Note that the duplex setting does not come from the PDF file itself but from
one of the command line options to the pdftops utility.

Helge
Thomas Gagne
2010-04-20 20:47:16 UTC
Permalink
Helge, since it's part of the setup (called immediately preceding
%%Page: 1 1) can I change the duplexing for page 7 using...

%%Page: 7 7
%%BeginPageSetup
%%PageOrientation: Portrait
pdfStartPage
<< /Duplex true >> setpagedevice


Also, once I turn duplexing on, do I have to turn it off for the next
page or will it turn-off automatically?
Helge Blischke
2010-04-20 21:28:11 UTC
Permalink
Post by Thomas Gagne
Helge, since it's part of the setup (called immediately preceding
%%Page: 1 1) can I change the duplexing for page 7 using...
%%Page: 7 7
%%BeginPageSetup
%%PageOrientation: Portrait
pdfStartPage
<< /Duplex true >> setpagedevice
Also, once I turn duplexing on, do I have to turn it off for the next
page or will it turn-off automatically?
You need to turn it off again, but note that you need two pages to be
printed onto one sheet when duplexing.

Helge
Thomas Gagne
2010-04-21 00:52:35 UTC
Permalink
<snip>
You need to turn it off again, but note that you need two pages to be
printed onto one sheet when duplexing.
Helge
That's fine. We're working out how we can insert finishing commands
into a PS stream generated from thousands of PDFs. It's unfortunate
that PDF doesn't support printer commands like duplexing and tray pulls,
necessary for many commercial uses.

The utility I've prototyped looks like it could be scripted to identify
any number of patterns inside a page range (bounded by something easily
identifiable at present) to insert any PS--in our application that's
tray pulls and duplex commands. I'm going to ask the client if they'll
allow us to release it open-source so other programmers may use and
contribute to it as they're motivated.
James Cloos
2010-04-21 14:20:07 UTC
Permalink
TG> It's unfortunate that PDF doesn't support printer commands like
TG> duplexing and tray pulls, necessary for many ... uses.

The solution that Adobe and others have proposed is to encapsulate the
PDF files into some sort of Job-Ticket file, either directly embedded
or embedded by reference.

AIUI this has caught on in the large-run market (offset litho and the
like), I don't know how much support exists in the industrial and office
markets. The PDF/PS/PCL-capable printers probably all support HP's PJL
to specify pagedevice and similar options when directly printing PDFs,
but I haven't seen too much support for that in print spool or print
generation software.

Some of the work coming out of the IEEE's Printer Working Group should
address (some of?) this need. Cf http://pwg.org/

-JimC
--
James Cloos <***@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
Continue reading on narkive:
Loading...