FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

PRINTING

Get the number of copies to print


My response from the printer guru was:

"Your print loop needs to print as many copies as the publicly documented number of copies field says, wherever that is. The LaserWriter driver, and some others, hide the real value somewhere else, but you should ignore that. If you implement "A Printing Loop That Cares" from Apple's tech note <http://devworld.apple.com/dev/technotes/tn/tn1092.html> in FB, you should be set. In C, "numberOfCopies = (**thePrRecHdl).prJob.iCopies" and nothing else.

"As for printing ranges of pages, you can do it the slow way or the hard way. Suppose the user wants to print pages 3-6 of an eight-page document. If you leave the page numbers as they are, the printer driver wants you to print *all* the pages, and it will discard 1-2 and 7-8. The better way, implemented in the TN, is to only print pages 3-6, and change the print record to read pages 1-4, so it won't discard any. Again, Apple's already written this code -- just implement it in your application."

Two ways;

myPRHandle& = PRHANDLE
copies% = myPRHandle..prJob.iCopies%

or;

copies% = {[PRHANDLE]+66}

Bill


1) The number of copies printed is automatically handled by the printer driver. So if you want 3 copies of pgs 3-9, then you can just run thru your routine and the driver will sort out what it wants and what it doesn't.

2) In special cases you need to regulate this. (A) You might be trying to print pgs 1,2,3 + 1,2,3 instead of 1,1,2,2,3,3 or (B) You may be doing by-page formatting. First page landscape, second page portrait, etc. In either of these cases you must capture the range and the number of copies. Your range should be reset to 1-999 and the number of copies is usually set to 1.

3) You must change the print record before you begin to print. Here's the catch: the value used for number of copies is supposed to be uniform throughout all printer drivers, but was moved in HP drivers. (Dunno Y...) That's why we pick and choose between printers to get the proper offset to the number of ocopies in PG's print utility.

STAZ ~)~


However... this is only "sort of" true, depending on the driver. If the driver _does_ handle copies automatically, it should always return "1" to your program in PRHANDLE as the number of copies. If it _doesn't_, then you have to print however many copies the user asked for. It's a gamble; on my Epson, for example, if you don't handle it, I'll ask for 3 copies and only get 1!

All drivers are supposed to handle the page range selection for you, so unless speed is an issue, you don't need to worry about that. If you _do_ handle it yourself, you have to modify the print record; if you _and_ the driver handle it, and the user said "pages 3 through 9", you'll send pages 3-9, and the driver will ignore the first 2, thinking they're pages 1 & 2!

Since I'm trying to create a generic print routine, I'll write up a "print record checking program" and test it with a bunch of printer drivers; I've got access to dozens of types of printers at work. The only common thing I _don't_ have access to is any of the HPs. So I'll hit the list when I get to that point and ask for help.

Bill