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

Export to PDF programmatically Lost Background

1 Answer 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cory
Top achievements
Rank 1
Cory asked on 23 May 2013, 02:44 PM
Hello all,

I have a report that contains a chart.  In the chart plot area, I set the background image using relative path (~/Image/myimage.png). Everything works as expected using ReportViewer on asp.net page.  The problem I have is when I export the report to pdf format programmatically, the chart background is not set.

Here is how I export it.

           
   public Stream GetReportBytes(Guid studyId, string userName)
        {
            ReportProcessor reportProcessor = new ReportProcessor();
            Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
 
            ProjectReport reportToExport = new ProjectReport();           
            reportToExport.ReportParameters[0].Value = studyId.ToString();
            reportToExport.ReportParameters[1].Value = userName;
            instanceReportSource.ReportDocument = reportToExport;
            RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
 
            return new MemoryStream(result.DocumentBytes);           
        }

And background image is set like this

MainChart.PlotArea.Appearance.FillStyle.FillSettings.BackgroundImage = "~/Images/ci_bg.png";


Please advice.

Cheers!

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 28 May 2013, 04:40 PM
Hello Cory,

Please double-check how the relative path used to set the background image is resolved. In case the report definition is in the web application the relative path will be resolved based on the same root. If you need additional assistance please send us a sample runnable project to debug on our side.

I hope this helps.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
Cory
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or