简体   繁体   中英

How to set default paper size to A5

I want to set my prnter's default paper size = A5

My code is

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. The documentation for the PaperSize property reads:

Set the PaperSize property for the page to a valid PaperSize , available through the PrinterSettings.PaperSizes collection.

If the printer supports A5 paper size, you can check the Kind property for a PaperKind.A5 value to lookup the correct settings. Or, make yourself a custom PaperKind instance with the respective dimensions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM