We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

ReportWriter external local image not exporting to PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

129831 Apr 5,2017 09:08 AM Apr 21,2017 05:44 AM UWP 5
loading
Tags: SfReportViewer
Alexandru Pastor Opris
Asked On April 5, 2017 09:08 AM

Hello,

I'm trying to export a report to PDF directly, without any report viewer control, just one button which exports to PDF and I've been using the ReportWriter class. I know that we can't directly export charts to a report due to UWP limitations as answered here:

https://www.syncfusion.com/forums/128689/report-pie-chart-not-showing-when-printing-pdf-or-exporting

So I decided to take a workaround and trying to generate that chart to an image and then loading it into the report dynamically from a local path. Now here comes the different points of view about the problem which I'm stuck at.

On my sample which I've attached below, there's an imagePath property with a local path that needs to point to any image locally.
And then if we take a look at the report we can see 3 images with some borders of different colors:
  1. The first one is an external type of image (source set to "External") set with a local value, the value is assigned via a parameter and programmatically from the code. I've tried a lot of ways of writing the path, none of them worked, till I decided to try an external image with a image online from a website. (Black border)
  2. This second image, is the external image loaded up from a website with its source set to "External", it is showing correctly on the report designer, no issues there so far. (Red border)
  3. And the last image which we have, has the source selected to "Embedded", now this image is also showing on the designer. (Blue border)
Once we launch the sample and click the export button, the filepicker opens up correctly and we can select the path on where to save the PDF. When we open the PDF we can see the following images:
  1. The external image is NOT seen, just the black border.
  2. The external image is NOT seen, even though we can see it in the designer correctly.
  3. The embedded image is seen correctly.
Now the question is, how can we solve this? I know that UWP has some limitations, but we really need to be able to export some kind of chart and now it's just a simple image which we're trying to load dynamically.

Also lastly, we would like to avoid the use of a WebAPI just for that.

Thanks and have a nice day,
Alexandru.

Attachment: RdlcExternalImage_3c11c103.rar

Vinoth Srinivasan [Syncfusion]
Replied On April 6, 2017 07:47 AM

Hi Alexandru, 
 
Thanks for contacting Syncfusion Support. 
 
We need web client and file browser to get the “external” type image in our source, but these are not supported for UWP without service, so the external images are not shown in your exported report. We can export the external type images by using the web api service. Since you don’t want to use the WEBAPI project, you can achieve this using DataBase image type in image report item. To achieve this add the chart images to your business object collection and insert image report item with “Database” image source type then use the image value date field in value of the report item. 
 
Regards, 
Vinoth S. 


Alexandru Pastor Opris
Replied On April 19, 2017 12:07 PM

Hi Vinoth,

Sorry for the late response, I've been trying different ways to make this to work but without success so far, is there any chance that you could provide a sample or even more information on how to approach this?

Thanks and have a nice day.
Alexandru.

Vinoth Srinivasan [Syncfusion]
Replied On April 20, 2017 11:02 AM

Hi Alexandru, 

You can convert the image stream into byte array and add it to business object collection. Create an image with “Datasource” source type and bind the field value to the image value property to export report to pdf. We have prepared a sample based on this and it can be downloaded from the following location. 

Regards,
Vinoth S


Alexandru Pastor Opris
Replied On April 21, 2017 03:14 AM

Hello Vinoth,

Thanks for the sample, but unfortunately I can't download the sample because its giving me an error with the code AccessDenied.

Can you please update the link or give me access to it?

Thanks so much, have a nice day.
Alexandru.

Vinoth Srinivasan [Syncfusion]
Replied On April 21, 2017 05:44 AM

Hi Alexandru, 

Sorry for the inconvenience caused. 

The sample can be downloaded from the following location. 


Regards, 
Vinoth S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;