Click to See Complete Forum and Search --> : PrintDlgEx and collated printing


Daniel Morris
March 31st, 1999, 10:17 AM
I'm trying to do a version of collated duplex printing on a plain one-sided non-collating printer (any printer).

.

In english ...

...I want to print many copies of a multi-page document.

...I want to print double sided ie both sides of the paper.

...I want each document to remain in order so I don't have to sort it out at the end of the print run.

...I want the application to wait for the user to take the 'half-printed' document (ie one side printed so far) and

place it in the paper tray so the printer will proceed to print on the 'other' side (ie non-printed so far).

.

For example I want to print 2 copies of a 10 page document.

.

My pseudo code (based on my current 'non-standard' MFC code) is :

.

// Code starts here ..

> Do twice // Two copies

> {

> Print pages 1,3,5,7,9 in that order // print 'odd' pages ie side 1 of paper

> }

> {

Stop and ask user to get the 'just printed' paper and put back in paper tray. Orient the paper so the printer will

print on the 'other' (un-used) side of the paper.

> }

>

> Do twice

> {

> Print pages 10,8,6,4,2 // print 'even' pages ie side 2 (unprinted)

> } // Print in reverse order - that is the way

> // they came out of the printer (hopefully)

> // ie Print page 10 on back of page 9

> // print page 8 on back of page 7 etc ...

>

// code ends

.

Having read a little in this great site I believe I must derive a class from CPrintDialog and CPrintInfo to accomplish

this task.

.

I have found some minimal documentation (and NO sample code sob, sob ) on PrintDlgEx. It seems to me that I must

replace the standard CPrintDialog and OnFilePrint routines. Is there any sample code around for PrintDlgEx?

.

The bottom line questions are:

.

....How do I print every second page in a document?

....How do I ask for user intervention in the middle of a print run?

....How do I print from the end of a document forwards every second page?

.

At the moment I have code that does all of the above but in a 'non-standard MFC' way. Is there any 'standard' MFC way

of accomplishing the above goals?

.

Another question that spans Global Variables and Printing ...

... In the MFC source code in VC6 the CPrintingDialog class uses a 'global' (I suppose) variable bUserAbort in

_afxWinState. What, where, and why is _afxWinState? I could not get it to 'work' so I supplied my own global variable

and it worked perfectly ie sends the 'cancel print' button state to the underlying print job.

.

Any ideas would be appreciated.