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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to insert the png image in PdfLightTable cell in xamarin IOS Platform?

Platform: WinForms |
Control: PDF
Tags: pdf, xamarin

How to insert the PNG images in PDF in Xamarin IOS Platform?

Currently Essential PDF for Xamarin support only jpeg images.  We can also insert PNG images in PDF by converting the PNG to JPEG by using the UIImage class available in Xamarin IOS. Please note that the transparent graphics won’t be preserved in this workaround.

The below code snippet used to convert the PNG image into jpeg images.


public Stream ToStream(string path)
Stream stream = new MemoryStream();
stream =  UIImage.FromBundle(path).AsJPEG().AsStream();
//stream.Position = 0;
return stream;


Then we can use the PdfImage class to load the jpeg image and draw it to the pdf, to add an image into the PdfLightTable cell we need to initialize the begin cell event.

Please refer the below code snippet to draw the image into PdfLightTable cell.


pdfLightTable.BeginCellLayout += new BeginCellLayoutEventHandler(pdfLightTable_BeginCellLayout);
void pdfLightTable_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
if (args.RowIndex > -1 && args.CellIndex > -1)
if (args.CellIndex % 2 == 0 && !string.IsNullOrEmpty(args.Value))
//Drawing the image
args.Skip = true;
PdfImage image = PdfImage.FromStream (ToStream("pdf.png"));
Syncfusion.Drawing.RectangleF rect = args.Bounds;
args.Graphics.DrawImage (image, new Syncfusion.Drawing.RectangleF (rect.X + 2, rect.Y + 2, rect.Width - 2, rect.Height - 2));




2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile