我尝试在热敏打印件上打印图像:
void Method()
{
var printDocument = new PrintDocument();
printDocument.PrinterSettings = new PrinterSettings() { PrinterName = "zebra" };
printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
printDocument.Print();
}
void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(System.Drawing.Image.FromFile(Server.MapPath("~/Images/orderedList6.png")), 0, 0);
}
但是没有打印文件。此外,文档在打印队列中可见,我可以打印到.xps文件。
答案 0 :(得分:0)
问题是你没有设置控制器
printDocument.PrintController = new StandardPrintController();
答案 1 :(得分:0)
IDocumentPaginatorSource flowDocument = You_Flowdocument;
var writer = PrintQueue.CreateXpsDocumentWriter(Your_printQueue);
DocumentPaginator documentPaginator = flowDocument.DocumentPaginator;
writer.Write(documentPaginator);
您可以通过热敏打印机dll使用UserPrintTicket.PageMediaSize
和Desity
来设置标签尺寸。