我正在编写一个控制台应用程序,我想在具有特殊纸张尺寸(例如:10英寸x 12英寸)的打印机上打印图像。我尝试使用自定义纸张尺寸,但失败了。
现在我正在尝试:
var printerSettings = new PrinterSettings
{
PrinterName = "Microsoft Print to PDF", //I will change it to actual printer later
PrintToFile = true,
PrintFileName = string.Format("{0}\\{1}.pdf", /*xps",*/
FullPrintJobFolder, SOPInstanceUID.UID)
};
printerSettings.DefaultPageSettings.PaperSize = new PaperSize("custom", 1000, 1200);
//setting the margins and orientation (Landscape/Portrait) here
printDocument.QueryPageSettings += OnQueryPageSettings;
printDocument.DefaultPageSettings.PaperSize = new PaperSize("custom", 1000, 1200);
printDocument.Print();
但是以上内容仅更改页面内内容的大小,而不更改页面的实际大小。我的意思是,当我检查生成的pdf文档的属性时,它显示纸张尺寸为8.50x 11.00in。但应为10.00x 12.00in。但是,此文档中的图像大小根据我的代码而改变。
请提供建议。 谢谢