SFChart.iOS Exporting to PDF or Image?

How Do i export the sfchart to image or pdf. The methods SaveAsImage, GetStream exists in xamarin form. they dont exist in xamarin.ios sfchart component.

Is there a way to export the chart to image or pdf?

5 Replies

DV Divya Venkatesan Syncfusion Team April 9, 2018 07:02 AM UTC

Hi Balasubramanian, 
 
Thanks for using Syncfusion products. 
 
We have prepared a sample to export chart to image. Please download the sample from the following link. 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Divya Venkatesan 



BR Balasubramanian Ramanathan April 9, 2018 01:09 PM UTC

Hi,

Thank you. Now i can export to file. It would be nice if the sfchart component provide a method to do this automatically. 

Regards


PS Parthiban Sundaram Syncfusion Team April 10, 2018 09:47 AM UTC

Hi Balasubramanian,

Thanks for the update. We are glad that the given solution has helped to achieve your requirement.

Regarding “It would be nice if the sfchart component provide a method to do this automatically

We would like to inform this is the generic way to export the view / custom control in Xamarin iOS. However, we will consider your suggestion in near future. 
 
Please let us know, if you need further assistance on this.

Regards,
Parthiban S
 



VI Victoria September 8, 2018 01:24 AM UTC

I just downloaded that solution and I pressed the save button but it crashed the app after pressing it. It crashes at this part of the code              image.SaveToPhotosAlbum(new UIImage.SaveStatus(delegate (UIImage img, NSError error) { }));
Could you help me out?



MP Michael Prabhu M Syncfusion Team September 11, 2018 09:59 AM UTC

Hi Victoria, 
 
Greetings from Syncfusion, we have analyzed the reported issue, and this is a common issue. You must permission to access the drive to save images to photos library in info.plist file for iOS 11 and above version. 
 
Please follow below steps to enable the access to save image in phots library: 
1.Open info.plist file . 
2.info.plist have three tabs at bottom. Click to Source tab. 
3.Add new entry as Privacy – Photo Library Usage Description and PrivacyPhoto Library Addition Usage Description. 
4.Add the Value as This App needs permission to access the Photos. (Refer screenshot below) 
Each of the privacy keys map to specific values that are set in the Info.plist. Opening it in a text editor, we’ll see the following: 
Info.plist 
<key>NSPhotoLibraryUsageDescription</key> 
<string>This App needs permission to access the Photos</string> 
<key>NSAppleMusicUsageDescription</key> 
<string>New Entry</string> 
<key>NSPhotoLibraryAddUsageDescription</key> 
<string>This App needs permission to access the Photos</string> 
 
 
Screenshot: 
 
We have also prepared a sample based on this and it can be downloaded from the below link. 
Sample: 136911  
Thanks, 
Michael 
 


Loader.
Up arrow icon