This is a migrated thread and some comments may be shown as answers.

Issue with ExportToImage

2 Answers 58 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Dennis Perlot
Top achievements
Rank 1
Dennis Perlot asked on 30 Jul 2012, 02:03 PM
Hi all,

I've been using the following code to generate PNGs or Bitmaps:

Telerik.Windows.Controls.RadChart chart = ExtractRadChart(_canvasToPrint.Children);
 
if (saveImage.ShowDialog() == true)
{
    BitmapEncoder encoder = null;
    if (saveImage.SafeFileName.ToLower().EndsWith(".png"))
    {
        encoder = new PngBitmapEncoder();
    }
    else
    {
        encoder = new BmpBitmapEncoder();
    }
 
    using (Stream fileStream = saveImage.OpenFile())
    {
        ExportExtensions.ExportToImage(chart, fileStream, encoder);
    }
}

But recently some of my clients have told me that it generating a corrupt file with 1kb size.

The Telerik DLLs version is  2011.1 

Any ideas why? User permissions? ...

Thank you.

2 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 31 Jul 2012, 07:27 AM
Hello Dennis,

Were you able to reproduce this behavior? I have created a small project based on your code, I tested it and it exports the chart as expected. I have attached this project for you to test as well. If you can reproduce this issue you can create a new project and send it to us in a new support ticket so we can investigate and look for solutions. 

Greetings,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dennis Perlot
Top achievements
Rank 1
answered on 07 Aug 2012, 07:08 PM
Hi Petar,

Thank you for your help.

 I was able to find the issue, the data was not getting bound to the chart via MVVM.
 Once I explicitly bind the data it captured it as expected.

Thank You!

Tags
Chart
Asked by
Dennis Perlot
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Dennis Perlot
Top achievements
Rank 1
Share this question
or