如何在WinForms应用程序中设置爱普生打印机的媒体名称?

nle07wnf  于 2023-06-24  发布在  其他
关注(0)|答案(1)|浏览(84)

如何在WinForms应用程序中将爱普生打印机的介质名称设置为“自定义”?我尝试使用以下方法设置:

new PaperSize("Custom", Convert.ToInt32(width * 0.3937 * 100), Convert.ToInt32(height * 0.3937 * 100));

但没有成功我该怎么办?

q8l4jmvw

q8l4jmvw1#

您还没有向我们展示所有的代码,这里有一个工作示例:

using System.Drawing.Printing;

PrintDocument printDocument = new PrintDocument();
PaperSize customPaperSize = new PaperSize("Custom", Convert.ToInt32(width * 0.3937 * 100), Convert.ToInt32(height * 0.3937 * 100));
printDocument.DefaultPageSettings.PaperSize = customPaperSize;

// I'm not sure if you'll need this for a Sqaure Paper size? Try printing with and without this line.
printDocument.DefaultPageSettings.Landscape = true;

相关问题