This can be caused by a number of different things. There are several steps you can add that, when done correctly, can cause flying people to return with goods and knowledge.
First, you have to scale to a printed page (code from 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");
The cult-load code is in the “Measurement” and “Arrange” steps. Often, if you call "Measure" and pass in everything new that you need to do in new Size(Double.MaxValue, Double.MaxValue) .
The second ritual involves the controller's strike.
visual.DataContext = foo; Dispatcher.Invoke((Action)()=>{;}); // bamp // print here
Try and see if this helps.
source share