[英]How to set default paper size to A5
I want to set my prnter's default paper size = A5 我想将打印机的默认纸张尺寸设置为A5
My code is 我的代码是
printDocument.DefaultPageSettings.PaperSize.RawKind = 11;
printDocument.DefaultPageSettings.PaperSize.RawKind = 11;
but this code does not work. 但是此代码不起作用。 Is there any other way?
还有其他办法吗? Please Help me.
请帮我。
You cannot just blindly modify one property within the PaperSize
object and expect it will work. 您不能只盲目地修改
PaperSize
对象中的一个属性并期望它会起作用。 The documentation for the PaperSize
property reads: PaperSize
属性的文档显示为:
Set the PaperSize property for the page to a valid PaperSize , available through the PrinterSettings.PaperSizes collection.
将页面的PaperSize属性设置为有效的PaperSize ,可通过PrinterSettings.PaperSizes集合获得。
If the printer supports A5 paper size, you can check the Kind
property for a PaperKind.A5
value to lookup the correct settings. 如果打印机支持A5纸张尺寸,则可以检查
PaperKind.A5
值的Kind
属性以查找正确的设置。 Or, make yourself a custom PaperKind
instance with the respective dimensions. 或者,使自己成为具有相应尺寸的自定义
PaperKind
实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.