这可能是由许多不同的事情造成的。有迹象表明,你可以添加,当正确执行,可能cause the flying men to return with goods and knowledge.
首先,你应该扩展到打印页面几步(代码a2zdotnet):
System.Printing.PrintCapabilities capabilities =
printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
//get scale of the print wrt to screen of WPF visual
double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth/this.ActualWidth, capabilities.PageImageableArea.ExtentHeight/
this.ActualHeight);
//Transform the Visual to scale
this.LayoutTransform = new ScaleTransform(scale, scale);
//get the size of the printer page
Size sz = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
//update the layout of the visual to the printer page size.
this.Measure(sz);
this.Arrange(new Rect(new Point(capabilities.PageImageableArea.OriginWidth, capabilities.PageImageableArea.OriginHeight), sz));
//now print the visual to printer to fit on the one page.
printDlg.PrintVisual(this, "Code ganked from http://www.a2zdotnet.com/View.aspx?id=66");
货物邪教代码是度量和安排步骤。通常,如果您打电话给Measure并通过new Size(Double.MaxValue, Double.MaxValue)
这就是您所需要做的。
第二种仪式涉及碰撞分派器。
visual.DataContext = foo;
Dispatcher.Invoke((Action)()=>{;}); // bamp
// print here
试试看看是否有帮助。
的伎俩,你试过简化PrintInvoice,看看他们是被导致与惠普打印机问题的任何元素? – RQDQ 2011-01-25 14:17:00
PrintInvoice是一个页面,它在Microsoft XPS Document Writer中的输出是完美的。 – 2011-01-25 14:28:49