Printing "x" pages per sheet

B

Boris

Hi All,
In c# or vb.net, when i throw the print Dialog, is there any way i can
retrieve the value that the user has chosen for the pages to be
printed per sheet?
for e.g. in the "Layout" tab of the print dialog, there is an option
which says how many pages needs to be printed per sheet. But whatever
value i give here, the output that gets printed is always just 1 page
per sheet.
I searched in PrintDocument ,PrinterSettings class etc..There doesn't
seem to be any property or some other way to retrieve this value

Some articles suggest examples of throwing a customized dialog instead
of default print dialog where we hide these details like "pages per
sheet".
But i do not think this is the right way as we are just avoiding
things which we do not know how to do. What if the user still wants to
have for e.g say "2" pages per sheet?

Is this a known bug or iam missing something?

thanks in advance.
Ben
 
R

Ron Allen

Boris,
I just tried this here and I don't have to do anything to make this
happen except select the # of pages/sheet in the PrintDialog. This is with
Framework 1.1.

Ron Allen
 
B

Boris

Hi Ron,

I just wrote a sample program to illustrate my point.
-----------------------------------------------
int i =1; //
....
PrintDocument printDocument = new PrintDocument();
PrintDialog p = new PrintDialog();
p.Document = printDocument;
if (p.ShowDialog() == DialogResult.OK) //Show the default Dialog here
{
printDocument.PrintPage += new
PrintPageEventHandler(this.pd_PrintPage);
printDocument.Print();
}
--------------------------------------------------
In the evenhandler I do nothing. Just have a variable called "i" to
determine how many pages that needs to be printed.

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
if (i < 4) ev.HasMorePages = true;
else ev.HasMorePages = false;
i++;
}

Now, running this should PRINT 4 BLANK PAGES.(since i do not have any
other logic.)
If i choose "4" pages per sheet in my printer settings, there shud be
only 1 blank page.
STILL IT PRINTS 4 BLANK PAGES.!!!!!!!!!

Why?
Same behaviour with both 1.0 & 1.1.

Any help appreciated. Let me know if iam wrong somewhere or if there
are some printer settings that needs to be enabled.
Note that all other applications like MSWord,Excel etc produce proper
behaviour.
So i think my printer settings are correct.

Thanks
Ben
 
R

Ron Allen

Boris,
I'm not exactly sure what is happening but it may be due to not drawing
anything. My printing is done in a complete PrintDocument override class
that handles OnBeginPrint, OnEndPrint, OnQueryPageSettings, and OnPrintPage
and also calls the base event for each of these events. When I request
multiple sheets/physical page it just comes out correctly and rotates
landscape pages as required. Possibly this has something to do with just
using the handler added to the base class which means that you aren't
calling the base class logic.
Maybe you could try printing an array of strings with 1/page and see if
this changes anything.

Ron Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top