PrintDocument size, print current page

milosh

Active member
Joined
May 11, 2011
Messages
33
Programming Experience
1-3
Hi all.
How to print current page when select in printdialog control?
And how to set size of printdocument to A4. I reading some posts where people say that size is depends on resolution?
Is that true?
Thanks.
 
How to print current page when select in printdialog control?
Assigning a PrintDocument object to the dialog will ensure selections are transferred from the dialog, typically you can configure this in designer if you only have one PrintDocument object. Then you must handle those settings when implementing the printing. The page settings can be read from the documents PrinterSettings. Both PrintRange options CurrentPage and Selection depends on what you are displaying in your client window, for example if you are displaying some kind of data records that is supposed to print one each page then CurrentPage for you would mean that the data record currently displaying in your application is to be printed, another example could be a TextBox where user have selected some text and that is the text you should print when user selects PrintRange.Selection. You can set the Allow properties of PrintDialog (for example AllowSelection) before showing it to user to allow the relevant page selection options.
And how to set size of printdocument to A4.
You can use the PageSetupDialog (assign it the PrintDocument object) and select the paper size. When dialog is confirmed the paper size is set in the documents DefaultPageSettings.PaperSize.
 
You can use the PageSetupDialog (assign it the PrintDocument object) and select the paper size. When dialog is confirmed the paper size is set in the documents DefaultPageSettings.PaperSize.

OK...but how to programatically set this.
I try something like:
printLagera.DefaultPageSettings.PaperSize.Kind = Printing.PaperKind.A4
but error occured:
Property 'Kind' is 'ReadOnly'.
 
printDoc.defaultPageSettings.PaperSize = printDoc.PrinterSettings.PaperSizes.item(7)
this is A4 format

Thanks a lot.
Now rest me to implement curent page printing.
 
Back
Top