Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NumCopies command 1

Status
Not open for further replies.

tomte

Technical User
Nov 14, 2002
47
US
I am having difficulty changing the numcopies command on a page by page basis. In essence here is what I want to accomplish. A generic postscript level 2 file generated either with the adobe generic driver or ghostscript. Collated and 1 copy. I then want to break the file before the showpage command and vary the copies on a page level basis. Example Before change

%%EndDocument

LH (where showpage has been redefined by the driver)

(%%[Page 1]%%) =
%%PageTrailer

%%Page: 2 2

After Change

%%EndDocument
/NumCopies 3 def
LH (where showpage has been redefined by the driver)

(%%[Page 1]%%) =
%%PageTrailer

%%Page: 2 2

This does not appear to be functioning. Any ideas out there on how to accomplish this?
 
"/NumCopies 3 def" by itself doesn't do anything. It's just a definition. To be of any use, it likely has to be used as part of a setpagedevice dictionary.

Try:

Code:
<</NumCopies 3>> setpagedevice


Thomas D. Greer
 
Sorry,

Yes, I am using the setpagedevice I have also tried <</NumCopies >> setpagedevice followed by a /#copies 3 def command. Whatever, I do the printer only takes the first instance of /NumCopies or /#copies that it locates and ignores all following changes.
 
Then your printer doesn't support page-by-page variations. It obviously considers number of copies to be a job level setting rather than a page level.

There is an older operator / code segment that will work in LanguageLevel 2 devices. Instead of showpage, use:

Code:
3 {copypage} repeat
erasepage

To create 3 copies of a page. Copypage behaves differently in LanguageLevel 3.

It looks like you're doing everything correctly.

The &quot;/#copies 3 def&quot; syntax was LanguageLevel 1, and should still work. Use it right before your call to showpage.

The /NumCopies entry in the setpagedevice dictionary is Level 2 & 3, and should work fine.

Copypage is officially &quot;discouraged&quot;.


Thomas D. Greer
 
Tom,

Is there a routine you can use with printers that do not support page level changes to this command?
 
Just so I understand, you want to image any given page an arbitrary number of times, right? With driver-generated PostScript?



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
That is correct. I would like to break a file on showpage and image that page. Example: I have a word document that generates a ps file. Contained within that word document is a form that I need in triplicate and an instruction set on filling out the form. I want to print 1 copy of the instructions and vary the form 3 times, then reset the the next set of instructions to 1 copy and so forth.
 
Let me work on it a bit. Maybe something with /BeginPage or /EndPage setpagedevice dictionaries can do the trick.

You can email me a sample file - that would help. You can get my email address from my website.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Ok, here's the result of my research and testing.

Distiller and GhostScript ignore almost all setpagedevice keys, including NumCopies.

The PostScript Language Reference Manual says &quot;For a device that produces output on a physical medium such as paper, showpage can optionally transmit multiple copies of the page...&quot; via NumCopies.

Since Distiller et al don't output on &quot;physical medium&quot;, these keys are simply ignored.

The /EndPage and /BeginPage procs, for obvious reasons, cannot contain the &quot;showpage&quot; operator, so there is no way to force showpage to output the same page multiple times.

&quot;showpage&quot; implicitly performs an &quot;erasepage&quot;, clearing the raster memory of the page. So once showpage fires, there is no longer a &quot;copy&quot; of the page in memory.

The only modifications to that behavior involve NumPages, which Distiller ignores, and the /EndPage pagedevice key, which can choose between two behaviours: image and then erase the page, or forget the page altogether.

To boil it all down, I see two choices:

1) Your program that parses the PostScript must copy ALL OF THE CODE FOR A PAGE, however many times you want that page to appear.

2) Use /NumCopies and /Collate in setpagdevice dictionaries prior to each page. /NumCopies should equal the number of copies of that page you want to make, and /Collate should be set to &quot;false&quot; (this forces NumCopies to work for the Page instead of the whole Document).

I sincerely hope this helps.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Tom,

Thank you I will give that a try. I have been away from the forum for awhile. I appreciate all you contribute.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top