Printing problem... with chart

2 posts, 0 answers
  1. Junyoung
    Junyoung avatar
    1 posts
    Member since:
    Nov 2011

    Posted 11 Jan 2012 Link to this post


    I tried to print out the chart.
    I created some codes with reference to the source code of demo project(Export PDF/Print), but following exception has occurred.

    I've tried to save docx file. It worked fine. please check my codes......


    private void PrintChart()
                RadRichTextBox RadRichTextBox1 = new RadRichTextBox();
                RadRichTextBox1.Document = CreateDocument();

    // below line made a exception : NullReferenceException was unhandled


            private void CreateChartDocumentPart(RadDocument document)
                Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
                Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();

                MemoryStream ms = new MemoryStream();
                currentChart.ExportToImage(ms, new PngBitmapEncoder());

                double imageWidth = currentChart.ActualWidth;
                double imageHeight = currentChart.ActualHeight;
                if (imageWidth > 625)
                    imageWidth = 625;
                    imageHeight = currentChart.ActualHeight * imageWidth / currentChart.ActualWidth;

                ImageInline image = new ImageInline(ms, new Size(imageWidth, imageHeight), "png");



            private RadDocument CreateDocument()
                RadDocument document = new RadDocument();


                return document;

  2. Nikolay
    Nikolay avatar
    384 posts

    Posted 13 Jan 2012 Link to this post


    Please, have a look at this forum post, it may be helpful in your scenario. In case the proposed solution does not work for you, could you please open a support ticket and send us a sample runnable application that we can debug locally and provide further support.

    All the best,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft R3 2016 release webinar banner
Back to Top