Hi
I have a silverlight column series chart using the SL5 XamDataChart in v12.1
I've read Petar monov's article but it's about converting a control to images, nothing on how to print.
Some of the dlls his example uses are from the WPF4. I tried adding that to my solution but could not as my solution was built against the silverlight runtime.
here's Petar's blog, but I can't add WPF dlls to my project.
http://blogs.infragistics.com/blogs/petar_monov/archive/2012/03/14/controls-to-images.aspx
please advise?
thanks,
Steven
Hi Steven,
I have been looking into your enquiry and the blog post has two samples projects in the attachment one WPF and one Silverlight as explained in the first paragraph of the article: “Recently there has been a great demand for the XamDataCharts to be exported outside their respectful applications as images. Usually WPF provides the functionality that is needed to extract an image of any control that inherits from the Visual class. Also with the help of the Infragistics Excel engine and I have been able to gather in a singles sample project (XamDataChart_to_Image.zip) exporting to: Excel, *.png, *jpg and the Clipboard.” Also the mentioned samples is added to the “Samples.zip” attachments.
Please let me know, if you require any further assistance on the matter.
how would I incorporate print to print the WriteableBitmap? and setting the image to fit a single page?
I can't implicitly convert a WriteableBitmap to a System.Windows.UIElement
Is it possible to do something like this?
private void Button_Click_Print(object sender, RoutedEventArgs e) { WriteableBitmap writablebmp = new WriteableBitmap(gridContainer, null);
writablebmp.Invalidate();
int width = (int)this.gridContainer.ActualWidth; int height = (int)this.gridContainer.ActualHeight;
PrintDocument dlChart = new PrintDocument();
dlChart.PrintPage += (s, args) => { args.PageVisual = writablebmp;
}; dlChart.Print("Chart");
}
Hello Sanju,
Peter has already attached solution on version 12.1 here:
http://ko.infragistics.com/community/blogs/petar_monov/archive/2012/03/14/controls-to-images.aspx
I tried the same as of Sample in my project but i am getting some errors:
1. i can't found System.Drawing under reference, in order to add it
2. getting error for RenderTargetBitmap
3. getting error for PixelFormats
4. getting error for FormatConvertedBitmap
5. getting error for BmpBitmapEncoder
6. getting error for BitmapFrame
7. getting error for PointF
8.getting error for Process
Can you help me to solve the same.Thanks in advance.
I am using Infragistic v12.1 and SL5
Regards,
Sanju
Hi Steve,
I am really glad to hear that and also thanks for the feedback and the additional link.
Thank you Petar, those links resolved my issue.
Also I would like to add the following for reference for whoever in the future that is looking a similar issue like mine.
http://jacekjura.blogspot.com/2010/11/silverlight-printing-fit-to-page.html
I now understand your question and I seem to have misread your first reply in addition. I can suggest reading this article on printing from MSDN and SMDN magazine: http://msdn.microsoft.com/en-us/library/system.windows.printing.printdocument(v=vs.95).aspx , http://msdn.microsoft.com/en-us/magazine/hh148152.aspx which describe the basic functionality and issues. Basically what you can do is put the Image control to the PageVisual.