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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

151330 Feb 7,2020 02:21 AM UTC Feb 7,2020 12:07 PM UTC WinForms 1
loading
Tags: PDF
Martin Sato
Asked On February 7, 2020 02:21 AM UTC

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?

Thanks.

Sowmiya Loganathan [Syncfusion]
Replied On 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(); 
 
document.Form.SetDefaultAppearance(false); 
 
//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 
document.Form.Fields.Add(textBoxField); 
 
 
Output screenshot: 
 
 
 
Please try the above solution in your end and let us know if you need any further assistance on this.  
 
Regards, 
Sowmiya Loganathan 


CONFIRMATION

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