Newsgroups: comp.sys.xerox
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!howland.erols.net!torn!kwon!watserv3.uwaterloo.ca!beu
From: beu@dcs1.uwaterloo.ca (Bruce Uttley)
Subject: Re: bin control in postscript to docutech?
Message-ID: <E2GsKH.89E@watserv3.uwaterloo.ca>
Sender: news@watserv3.uwaterloo.ca
Nntp-Posting-Host: dcs1.uwaterloo.ca
Organization: University of Waterloo
References: <58pg25$ru@Mercury.mcs.net>
Date: Sun, 15 Dec 1996 17:00:17 GMT
Lines: 421

In article <58pg25$ru@Mercury.mcs.net>, Leslie Mikesell <les@MCS.COM> wrote:
>We are using the windows print driver to send postscript jobs to
>a docutech and would like to be able to control the paper type
>from page to page within the word processor.  We can specify this
>with the job-ticketing software but that's not where we need it.
>One particular job involves section headings on white paper with
>the body on blue with macros in the wordprocessor handling all
>the formatting (the sections are separate subdocuments with
>several master documents to print different ways).  Is there any
>way to avoid the manual step of figuring out which final pages
>need to be which color and punching it into a job ticket (there
>are a couple hundred sections and it will change on every revision...)?
>
>I can intercept the job in a unix print spooler and pass through a
>perl script or something similar if necessary.
>
>Les Mikesell
>  les@mcs.com

We had the same requirement to control the input bins on a DocuPrint.
Xerox directed me to the Document Structing Conventions section of
the 2nd edition of Adobe's PostScript Reference (Red) book.  It
turned out that was overkill as it included some operators that were
not implemented.
   Xerox support forwarded me a .PDF file that told me what I needed.
I've enclosed it below in its text equivalent.  As you suggest, I had
to pass my print job through a filter (REXX for me) to add the bin
magic to the print file.  I have no idea how close a DocuTech solution
might be to these DocuPrint instructions.

--------

                      Introduction
                      ============

This collection of examples of documents and postscript code was
created as a result of multiple requests from the field for more specific
guidance on the use of both PostScript DSC, Document Structuring
Conventions and the implementation of the Postscript level 2
"setpagedevice" operator. All explanations are discussed only as they
apply to the Docuprint family of printers currently 390 and 350HC
running 1.2X version of print server software.

The explanations will contain excerpts from the PostScript Compatibility
Guidelines with sample code as well as editorial comments on things to
watch out for.
These samples will be very simple and include comments preceded by
   % for following along.
The user is encouraged to experiment with these samples to get the
most from them. The document will be updated with lessons learned as
we receive feedback from the field.


Centralized Integration Support Group
El Segundo

PostScript is a Registered Trade Mark of Adobe Systems Inc..

page 1 of 14
------------

         Static Media Specification
         ==========================

The Docuprint 1.2X/1.3 is capable of utilizing a subset of the Postscript
Document Structuring Conventions ( DSC ) as described in the Second
Edition of the Postscript Language Reference Manual appendix G page
611. The static media specification determines what media to print the
job on in the absence of a media request in either the submission
protocol or the Postscript setpagedevice operator.


     The four sources of static media specifications in order
                  of priority are.

1. External. These are the user supplied requests at print time and have
the highest priority. They can be conveyed using lpr, the Xerox supplied
print command, Macintosh XPPS job submission or the Apple chooser
level print window. When supplying Media this way one must remember
that this will be the only media the setpagedevice operator can selet
from. Not the way to go.

2. Virtual Printer If job submission, DSC, and setpagedevice are not
specified in the job then the attributes assigned to the target virtual
printer will take effect. The virtual printer can be assigned media
categories which include but are not restricted to
Media,Staple,plex,CopyCount. This Assignment may include multiple
media per entry delimited by a ",". Better than the prevous method.

3. DSC The DSC is always parsed as part of the document prescan and
the media contained in the %%Requirements: becomes available for
the Postscript setpagedevice operator to select from. The Best method.

4. Default Media. Lastly if none of the above mentioned specifications
are provided the default settings which were set using "Set Default
Media" are used. setpagedevice won't work this way.


page 2 of 14
------------

The following DSC comments are supported:

Comment Red Book Location

%%Creator        page 642
%%DocumentMedia  see attachment
%%For            page 644
%%PageOrder      page 646
%%Requirements   see attachment
%%Title          page 646


page 3 of 14
------------

            %%DocumentMedia:
            ================

This DSC comment when placed in the header of the Postscript file will
cause the defined media if present on the printer ( via SET TRAYS) to be
used for printing the document . If the media is not present the job will
be listed as INELIGIBLE and require matching SET TRAY variables to start
printing.

NOTE: AS OF 1.29.X ALL SETPAGEDEVICE CALLOUTS MUST HAVE A
PREVIOUSLY DEFINED MEDIA TO FUNCTION CORRECTLY. You may
define via virtual printer or %%DocumentMedia.
DocumentMedia is preferred because it makes the document
transportable.

The context of the comment is:
%%DocumentMedia: white 612 792 75 white topsecret
white = Tag name of the media, this is not used on Docuprint but must
be present in the comment. If not present the document may stay in a
constant processing state. The actual name does not matter in the
Docuprint implementation.
612 792= This is the paper size measured in Postscript Units (72) per
inch.
72 x 8.5 = 612 72 x 11=792 = USLetter
72 x 8.5 = 612 72 x 14 =1008 = USLegal
75 = weight in g /m 2 This is the grams per square meter value of the
media. 20 lb. is 75 , 65 lb. is 176 etc. This number can be found on the
side of a paper ream next to the Substance entry. This is a relative value
and does not have to exactly match the weight of the paper itself but
must match a current tray for the job to be printed. For instance you
could use 2 for weight as long as 2 meant something to the user as well
as having a matching tray.
white = the media color
topsecret = the media type, such as the name of a pre-printed form.
Can be named to suit customer requirements

page 4 of 14
------------

Sample:

%! PS
%%DocumentMedia: anything 612 792 75 yellow topsecret
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(this is page 1) show
showpage
100 100 moveto
(this is page 2) show
showpage

The above job will require that the following conditions be satisfied on
the server before it can be printed.
size=USletter, weight=75,color=yellow, type =topsecret.

page 5 of 14
------------

It is unusual that a job would be set up to require all options to be
satisfied so the following example will demonstrate a comment that
uses only USLetter on a pre-printed form called CorpLogo..

%! PS
%%DocumentMedia: anything 612 792 0 ( ) CorpLogo
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(this is page 1) show
showpage
100 100 moveto
(this is page 2) show
showpage

Points to note:
If any of the attributes are not applicable to a particular printing
situation, a zero must be substituted for MediaWeight and null strings
(no spaces) must be substituted for text parameters. As in the above
sample where 0= weight and ( )=color. If this substitution is not
followed unpredictable results may be encountered.
Although the above example has () a null entry for media color it is a
best practice to always include the paper color in any definition. This will
insure a high degree of definition when the system has to match media
to trays
If a job contains multiple %%DocumentMedia comments and no other
media selection is supplied in the submission protocol the first comment
will take precedence.
Within a job all media must be the same size.

page 6 of 14
------------

     Describing multiple media comments within one job.
     ==================================================

To describe multiple media statements within one job you simply add
the next statement by using %%+ in the next line after the first
%%DocumentMedia statement. You can describe up to four statements
per job.
%%DocumentMedia: cover 612 792 176 white ()
%%+ pre-printed 612 792 75 white CorpLogo

When done correctly this will cause the job to be set to an ineligible
state if any of these media selections are not available via a SET TRAYS.
The main purpose for defining more than one statement would be the
Postscript level 2 operator setpagedevice which allows dynamic media
control within your jobstream.
It is mandatory to have a matching %%DocumentMedia comment for
every different instance of setpagedevice .

Sample:

%! PS
%%DocumentMedia: cover 612 792 75 white topsecret % #1
%%+ section 612 792 75 yellow () % #2
%%+ body 612 792 75 white () % #3
<< /MediaType (topsecret) /MediaWeight 75
   /MediaColor (white) >> setpagedevice % pre-printed topsecret logo #1
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(Missile Operator Instructions) show
showpage
<< /MediaColor (yellow) /MediaWeight 75
   /MediaType () >> setpagedevice % Yellow Chapter Cover #2
100 100 moveto
(Chapter 1) show
showpage
<< /MediaColor (white) /MediaWeight 75
   /MediaType () >> setpagedevice %Switch back to white for body
100 100 moveto
(this is page 1 of body) show
showpage
100 100 moveto
(this is page 2 of body) show
showpage

page 7 of 14
------------

        %%Requirements:
        ===============

This DSC comment as implemented in Docuprint describes document
requirements, such as simplex, duplex , number of copies and stapling.
The only higher priority for these attributes would come from the job
submission protocol (JSP).

The context of the comment is:

%%Requirements: duplex staple numcopies(2)

duplex = selected plex ,default is simplex if not otherwise modified by
JSP.
staple = stapled output if possible. Restricted to 50 physical pages. If
staple is included on larger documents or on printers not so equipped a
warning error will be printed after the completed job.
numcopies (2) = number of copies selected for this document. The
copies number must be in enclosed in parenthesis ( )


page 8 of 14
------------

Sample:

%! PS
%%Requirements: staple numcopies(5) duplex
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(this is page 1) show
showpage
100 100 moveto
(this is page 2) show
showpage

The above example will print the job stapled, five copies and printed on
two sides. Any subset of the four available selections
simplex,duplex,numcopies and staple is allowed. The order of the
comments are not important.

page 9 of 14
------------

     setpagedevice
     =============

The Docuprint product Version 1.2 supports a subset of the Postscript
level 2 operator setpagedevice.

The setpagedevice operator will not signal the printer to stop printing if
a selected media is not available.
Only the %%DocumentMedia comment will mark the job ineligible if
the needed media is not available.

It is imperitive to have a "%%documentmedia" statement for every
instance of a setpagedevice or defined media resources available from
the Virtual Printer media attribute.

The current subset of setpagedevice includes:
1. MediaWeight
2. MediaColor
3. MediaType

page 10 of 14
-------------

The context of the operator is :
<< /MediaWeight xx /MediaColor (xx....)
   /MediaType (xxx....) >> setpagedevice.

Where:
<< and >> construct a dictionary consisting of the bracketed objects
interpreted as key-value pairs. Always must be present and surround the
/MediaXxxxx entries.
/MediaWeight weight in g /m 2 This is the grams per square meter
value of the media. 20 lb. is 75 , 65 lb. is 176 etc. This number can be
found on the side of a paper ream label next to the Substance entry.
/MediaColor the paper color
/MediaType type or name of pre-printed form.

Sample:

%! PS
%%DocumentMedia: anything 612 792 75 white ()
%%+ anything 612 792 75 blue ()
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(this is page 1) show
showpage % END OF FIRST PAGE
<< /MediaColor (blue) /MediaWeight 75
/MediaType () >> setpagedevice
100 100 moveto
(this is page 2) show
showpage

page 11 of 14
-------------

If no specific media was called out in the job submission protocol
( which has the highest priority) the above job starts printing page 1 on
white paper then after the first showpage selects and prints page two on
blue paper.

Points to Note:
1. Every setpagedevice that describes a different media spec requires a
pre-defined %%DocumentMedia comment or a Virtual Printer media
definition for all instances of setpagedevice.
*** Only the %%DocumentMedia or Virtual Printer settings are
capable of placing the job in an ineligible state.
2. Once you invoke a setpagedevice it will take effect until the next
setpagedevice or until a restore goes back to a previous page device
spec. For instance if you call in yellow paper for a cover sheet you will be
required to call in white paper for the rest of the job, if not the first
setpagedevice will persist for the entire job.
3. If you issue a setpagedevice for a media spec that is not defined in a
%%DocumentMedia comment in will print on either the Job Submission
media definition or the default media specification.

Page 12 of 14
-------------

4. Care must be used when using setpagedevice with plex = duplex.
setpagedevice is ignored for the backside of a page.
5. It is required that you include along with a setpagedevice operator
all /Media references . /MediaWeight /MediaColor and /MediaType. Be
aware that this will require a complete match exist between the job
media and a printer tray before the document will be printed.
Please refer to the PostScript Compatibility Guidelines (page C-18)
sections on Media matching and Media limitations for additional
information.

page 13 of 14
-------------

%! PS
% Following line defines document to be stapled and copies set to 2
%%Requirements: staple numcopies(2)
%Following 3 lines define all setpagedevice call outs
%%DocumentMedia: topsecret 612 792 75 yellow topsecret
%%+cover 612 792 176 blue standard
%%+ body 612 792 75 white standard
%%EndComments
%Following line calls pre-printed TOPSECRET form for page 1 only
<< /MediaColor (yellow) /MediaWeight 75
   /MediaType (topsecret) >> setpagedevice
/Helvetica findfont 30 scalefont setfont
100 100 moveto
(Plans for Atomic Bomb) show
showpage
%Following line calls card stock for chapter cover for page 2 only
<</MediaColor(Blue) /MediaWeight 176
  /MediaType (standard) >> setpagedevice
100 100 moveto
(The Parts You Need) show
showpage
%Following line calls white paper for the rest of document.
<< /MediaWeight 75 /MediaColor (white)
   /MediaType(standard) >> setpagedevice
100 100 moveto
(list of parts page1) show
showpage
100 100 moveto
(list of parts page 2) show
showpage

page 14 of 14
-------------
