kurys Posted October 28, 2009 Report Share Posted October 28, 2009 Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> I have a problem that I think is similar to one already posted in your forum. Exporting bitmap thumbnails Last post 10-28-2008 11:57 AM by JuanC. 5 replies Your response said to request a hot fix by emailing wpf@softwarefx.com. Do you think this solution would work for this print problem? We are using version 8.0.3499.20290. The issue is when printing a user control that contains a ChartFX WPF chart. Both axes of the chart scale correctly, as does the rest of the user control, but the graph portion of the chart does not. It is smaller than it should be. See attachment sample print. It should go down to -0.03. <?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /> Below is the code that does the printing. this.elementToPrint is the control that contains the chart as well as other controls. private void OnPrintButtonClick(object sender, RoutedEventArgs e) { PrintDialog printDlg = new System.Windows.Controls.PrintDialog(); if (printDlg.ShowDialog() == true) { var view = this.elementToPrint; // get selected printer capabilities PrintCapabilities capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket); double old_width, old_height; old_width = view.ActualWidth; old_height = view.ActualHeight; // get scale of the print wrt to screen of WPF visual double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / old_width, capabilities.PageImageableArea.ExtentHeight / old_height); Transform old_transform = view.LayoutTransform; // Transform the Visual to scale view.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. view.Measure(sz); view.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(view, "Page Snapshot Print"); view.LayoutTransform = old_transform; sz = new Size(old_width, old_height); view.Measure(sz); view.Arrange(new Rect(new Point(0, 0), sz)); } } Thank you for your assistance. _________________________ Peter J Kurys The Blackstone Group 345 Park Avenue, 28th Floor New York, NY 10154 P: 646-313-6438 E: kurys@blackstone.com _ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.