开发者

Choosing Correct papersize when printing with .NET PrintDocument

开发者 https://www.devze.com 2022-12-18 00:12 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号