Issue with ExportToImage

3 posts, 0 answers
  1. Dennis Perlot
    Dennis Perlot avatar
    19 posts
    Member since:
    Dec 2009

    Posted 30 Jul 2012 Link to this post

    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. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 31 Jul 2012 Link to this post

    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.

  3. DevCraft banner
  4. Dennis Perlot
    Dennis Perlot avatar
    19 posts
    Member since:
    Dec 2009

    Posted 07 Aug 2012 Link to this post

    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!

Back to Top