Choosing Correct papersize when printing with .NET PrintDocument
When I am looping through each page I need to decide the size of a page and choose what size to print it in. is there an easy way to determine what size they are suppose to be? right now i was going by the ratio of width and height. If ratio >= 1.64 && ratio <= 1.65 Then Legal Size, If ratio >= 1.29 && ratio <= 1.30 The Letter Size. but how about if they are printing other sizes do i have to do this开发者_如何学C for each one?
There are several different things that can be considered the "size of a page": PrintDocument.DefaultPageSettings
is the default page settings from the printer driver. To determine "what size to print" I suggest using PrintDocument.DefaultPageSettings.PrintableArea.Size
rather than the aspect ratio.
If you display a print controller this can be overridden on each page; use the PrintPage event's PrintPageEventArgs.PageSettings.PrintableArea.Size
.
精彩评论