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

How can I set value with formatting like bold, italics, etc.

Good day,

  I have a pdf form with textfield in it, whe I opened it in adobe reader, I can fill up and set some text format such as bold, italics, underline, etc., I have a program that allows user to set basic formatting (bold,underline, italics) I want that value to fill my textfield, but it does not get formatted as I expected, my <b>text</b> tags are still displayed instead of parsed.

 How can I possibly do it?


1 Reply

SL Sowmiya Loganathan Syncfusion Team February 7, 2020 12:07 PM UTC

Hi Martin,  
Thank you for contacting Syncfusion support.  
We have analyzed your requirement. We can able to fill the form fields with text format (bold, italic, underline and strikeout) at a time in PDF document. Please refer the below code snippet for more details, 
//Create a new PDF document 
PdfDocument document = new PdfDocument(); 
//Add a new page to the PDF document 
PdfPage page = document.Pages.Add(); 
//Create a textbox field and add the properties 
PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName"); 
textBoxField.Bounds = new RectangleF(0, 0, 100, 20); 
textBoxField.ToolTip = "First Name"; 
//Set the font with style 
textBoxField.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12, PdfFontStyle.Bold | PdfFontStyle.Italic | PdfFontStyle.Underline | PdfFontStyle.Strikeout); 
textBoxField.Text = "Hello World Hello"; 
//Add the form field to the document 
Output screenshot: 
Please try the above solution in your end and let us know if you need any further assistance on this.  
Sowmiya Loganathan 

Live Chat Icon For mobile
Up arrow icon