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. Image for the cookie policy date

Share and Export pdf format

Hello We working xamarin native android and ios  We need share and export some data to pdf formatI found this solutionhttps://help.syncfusion.com/file-formats/pdf/working-with-xamarindo you have sample how to create table with rows and cells in the pdf ?Best Regards

8 Replies

SK Surya Kumar Syncfusion Team July 18, 2017 12:49 PM UTC

Hi Ehud, 
 
Thank you for using Syncfusion products. 
 
We have support for using Essential PDF in Xamarin.Forms , Xamarin.Android and Xamarin.IOS which  is built on Xamarin Portable platform. Also, we do not have support for PDF creation in native Android or IOS platform. 
 
The code snippet for creating tables using Essential PDF can be referenced from below UG documentation link: 
 
Please let us know if you need any further information in this. 
 
Regards, 
Surya Kumar 
 



EP Ehud Pinhas July 20, 2017 11:09 AM UTC

Hello 

I try this sample I can’t see the table in the pdf

I save the doc like this 


MemoryStream memoryStream = new MemoryStream();


//save the document into stream


doc.Save(memoryStream); 

and display the pdf in the application 

await Mvx.Resolve<ISave>().Save("Output.pdf", "application/pdf", memoryStream);

In this hello world sample, it works https://help.syncfusion.com/file-formats/pdf/working-with-xamarin

In the table sample it not works https://help.syncfusion.com/file-formats/pdf/working-with-tables

I don’t change noting from the sample only the overload doc save string this not exists 

Why this not working?


Best Regards



SK Surya Kumar Syncfusion Team July 21, 2017 02:13 PM UTC

Hi Ehud, 
 
 
We tried to reproduce the issue which you have mentioned in your last update, but we couldn’t reproduce the issue. 
 
We have attached the sample in which we tried to reproduce the issue, please modify the code in sample which we have given if you can reproduce the issue, so that we can help you further. 
 
Please find the sample link: 
 
 
 
Regards, 
Surya Kumar   



EP Ehud Pinhas July 23, 2017 12:35 PM UTC

Thanks this working should I work with PdfGrid or PdfLightTable ?I try to add an image to the document Follow this https://help.syncfusion.com/file-formats/pdf/working-with-imagesThe PdfBitmap don’t have constructor for string only stream  p.p1 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica} p.p2 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica; min-height: 13.0px} p.p3 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica; color: #0079cd} span.s1 {color: #000000} span.s2 {text-decoration: underline} Do you have sample how to load this stream from android and ios ? p.p1 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica} Best Regards


SK Surya Kumar Syncfusion Team July 24, 2017 12:24 PM UTC

Hi Ehud, 

Please find the response for your queries below: 


Query 
Response 
Thanks this working should I work with PdfGrid or PdfLightTable ? 
We would recommend you to use PdfGrid, because of its maximum functionalities. 


I try to add an image to the document Follow this https://help.syncfusion.com/file-formats/pdf/working-with-imagesThe PdfBitmap don’t have constructor for string only stream  p.p1 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica} p.p2 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica; min-height: 13.0px} p.p3 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica; color: #0079cd} span.s1 {color: #000000} span.s2 {text-decoration: underline} Do you have sample how to load this stream from android and ios ? p.p1 {margin: 0.0px 0.0px 8.0px 0.0px; font: 11.0px Helvetica} Best Regards 
In Xamarin platforms we do not have support to load image from specified path directly, image  can only be loaded as stream and  used. For loading image as stream, the image should be added to project reference and it can be loaded to stream with code snippet below: 

Please find the code snippet below to load image as stream and draw in PDF document. 
           //Create new document 
            PdfDocument document = new PdfDocument(); 
 
            //Add a page 
            PdfPage Page = document.Pages.Add(); 
 
 
            //Load the image in stream 
            Stream fStream = typeof(MainActivity).GetTypeInfo().Assembly.GetManifestResourceStream("PDFFormTesting.Assets.animals.jpg"); 
 
            //Load the image from the stream. 
 
            PdfBitmap image = new PdfBitmap(fStream); 
 
            //Draw the image 
 
            Page.Graphics.DrawImage(image, 0, 0); 
 
            using (MemoryStream stream = new MemoryStream()) 
            { 
 
                document.Save(stream); 
 
                Save("sample.pdf", "application/pdf", stream); 
 
            } 

We have attached a sample to load a image as stream and draw in PDF document which can be downloaded from below link: 



Please let us know if you need any further information. 

Regards, 
Surya Kumar 



EP Ehud Pinhas July 27, 2017 10:47 AM UTC

Thanks this Is working

But if I get the steam in the pcl form the application dll

The pdf bitmap constructor throw exception only support images of type jpeg 

If the image is jpeg it working 

Can I work with png image type?

Best Regards




SK Surya Kumar Syncfusion Team July 28, 2017 12:03 PM UTC

Hi Ehud, 
 
Currently we have support to use only “.jpeg” image format in Xamarin platforms, so you can use only “.jpeg” image format in Xamarin.Android platform . We have logged feature request for using “.png” image in Xamarin platforms, We will let you know once this feature is implemented.  
 
Please let us know if you need any further information 
 
Regards, 
Surya Kumar 



EP Ehud Pinhas July 30, 2017 03:42 AM UTC

Thanks

Best Regards 



Loader.
Live Chat Icon For mobile
Up arrow icon