使用.NET PrintDocument打印时选择正确的纸张尺寸 [英] Choosing Correct papersize when printing with .NET PrintDocument
问题描述
当我遍历每页时,我需要确定页面的大小并选择要打印的大小.是否有一种简单的方法来确定它们应该是什么大小? 现在我要按宽度和高度的比例进行计算. 如果比率> = 1.64&&比率< = 1.65然后是合法大小, 如果比率> = 1.29&&比率< = 1.30字母大小. 但是如果他们要打印其他尺寸怎么办?
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 for each one?
推荐答案
可以将页面大小"视为几项不同:PrintDocument.DefaultPageSettings
是打印机驱动程序的默认页面设置.要确定要打印的尺寸",我建议使用PrintDocument.DefaultPageSettings.PrintableArea.Size
而不是宽高比.
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.
如果显示打印控制器,则可以在每一页上将其覆盖;否则,请转至第二页.使用PrintPage事件的PrintPageEventArgs.PageSettings.PrintableArea.Size
.
If you display a print controller this can be overridden on each page; use the PrintPage event's PrintPageEventArgs.PageSettings.PrintableArea.Size
.
这篇关于使用.NET PrintDocument打印时选择正确的纸张尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!