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

Field Image

Thread ID:





146749 Aug 17,2019 10:48 AM UTC Aug 19,2019 10:45 AM UTC Xamarin.Forms 1
Tags: PDF
Martin Sato
Asked On August 17, 2019 10:48 AM UTC

Good day,

  How can assign value to my Image/Button field created from Adobe Acrobat DC Pro, I don't see corresponding field in Syncfusion.

Thank you.

Surya Kumar [Syncfusion]
Replied On August 19, 2019 10:45 AM UTC

Hi Martin Sato, 

Greetings from Syncfusion. 

As per the PDF specification, there is no separate form field for adding images. As a workaround we can achieve your requirement by creating new button field and replacing it to the existing one, please refer the below code for further details: 

PdfLoadedDocument loadedDocument = new PdfLoadedDocument( pdfStream, true); 
PdfLoadedForm loadedForm = loadedDocument.Form; 
for (int i = 0; i < loadedForm.Fields.Count; i++) 
Console.WriteLine(loadedForm.Fields[i].Name + " "+i); 
if (loadedForm.Fields[i] is PdfLoadedButtonField) 
PdfLoadedButtonField loadedField = loadedForm.Fields[i] as PdfLoadedButtonField; 
//Create new field and clone its parameters 
PdfButtonField field = new PdfButtonField(loadedField.Page, loadedField.Name); 
field.Bounds = loadedField.Bounds; 
field.BorderColor = loadedField.BorderColor; 
field.BorderStyle = loadedField.BorderStyle; 
field.BorderWidth = loadedField.BorderWidth; 
PdfImage image = new PdfBitmap(imageStream); 
//Add image to the appearance stream of the created field 
field.Appearance.Normal.Graphics.DrawImage(image, new RectangleF(0,0, field.Appearance.Normal.Width, field.Appearance.Normal.Height) ); 
// remove the existing field 
//Add the new field 
MemoryStream ms = new MemoryStream(); 

Let us know if you need any further information. 

Surya Kumar 


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.

Please sign in to access our forum

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

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
Live Chat Icon