我有一个MVC 4 web应用程序,它需要向两个网络打印机打印收据,这两个打印机应该是动态配置的(我不能使用window.print()),.I编写了一个我从web应用程序调用的小类,它成功地打印了一个空白页。如何使它打印包含收据信息的网页?
public class ServerPrint : PrintDocument
{
protected override void OnBeginPrint(PrintEventArgs e)
{
this.PrinterSettings.PrinterName = "\\\\PrintServer\\Printer01";
base.OnBeginPrint(e);
}
}和我这样称呼它:
var serverPrint = new ServerPrint();
serverPrint.Print();发布于 2014-10-30 11:53:11
最后,我创建了一个包含收据的活动报告,并在票据上设置了PrinterName对象,如下所示:
ticketReport.Document.Printer.PrinterName = printerName;发布于 2014-10-28 18:57:42
您可以创建一个printTemplate并使用表单数据填充它,如下所示:
public ActionResult PrintData(PrintModel model)
{
FillPrintTemplate(model);
//call print method
}https://stackoverflow.com/questions/26608939
复制相似问题