几天前,我试着用鼠标右键点击打印一张照片。出现一个对话框,选择打印机、PaperSize、质量等。我选择PaperSize = Legal
。打印机可以在标准尺寸的纸张上打印(我使用的是HP LaserJet 1020 plus打印机)。
现在,我正在尝试从C#打印一些内容,设置为PaperSize,但打印机无法正常打印。下面是我的代码。代码有什么问题吗?
this.printDocument.PrinterSettings.PrinterName = this.printSetting.PrinterName;
PaperSize pkCustomSize1 = new PaperSize("8.5x13", 1300, 850);
this.printDocument.DefaultPageSettings.PaperSize = pkCustomSize1;
this.printDocument.DefaultPageSettings.PaperSize.RawKind = 119;
printPreviewDialog.Document = printDocument;
printDocument.Print();
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Graphics g = e.Graphics;
Bitmap bm = new Bitmap(300, 3000);
// Code for bm.
g.DrawImage(bm, 0, 0);
}
所以问题是,设置PaperSize (和PrinterSetting)的正确方法是什么?还有一件事,我搜索了打印机的MaximumPrintableArea
。我的打印机有最大A4大小,为什么它在Legal
上打印
https://stackoverflow.com/questions/22087303
复制相似问题