Auto-detect page size (A4/LETTER) and print accordingly

KerryGan

Member
Joined
Jan 6, 2006
Messages
10
Programming Experience
1-3
Hi,

I'm trying to work out how to find out what the current printer page size setting is on a PC, then print on it accordinging to the page size.

I'm looking for something like this:
get printer page size ie A4 or LETTER
if neither set as LETTER

so then I would have a boolean to let the print doc know how to print the doc.
if PRINT SIZE =FALSE then print A4 else print LETTER

Many thanks
Sue:)
 
Thanks for the info, I'm not getting any where fast though. I have put
PrintDocument1.DefaultPageSettings.PaperSize.Kind()

in Private Sub PrintDocument1_PrintPage but it doesn't like PrintDocument1.

I've looked on MSDN but stilll can't work it out, do you have any ideas?

Thanks
Sue:confused:



 
I found out how to do it:
Dim PrinterPaperSize As String = PrintDocument1.PrinterSettings.DefaultPageSettings.PaperSize.Kind

Is this what you meant or did you have another method.

thanks for your help.

Cheers,
Sue:)
 
The mentioned property ...Kind is of type PaperKind which is an enumeration, you can get/set/compare the values of this type. You can also use the ...Kind.ToString() method to get a human readable string of the current value if you want to display in a label or something. If you want to change the PrinterSettings of some PrintDocument, do it before starting the print job. Normally it is not YOU who changes the printer/page settings, it's the USERS choice according to preference and available hardware/paper. You usually don't use the PaperSize in PrintPage event handler, but relate only to the PageBounds/MarginsBounds found through the methods e parameter.
 
Hi John,

do you relate only to the PageBounds/MarginsBounds found through the methods e parameter so that it can be scaled to what ever page size is selected?
Thanks
Sue
 
Back
Top