Replace TextBoxField value with text containing HTML formatting

I have an existing pdf with form elements in which I'm trying to populate. I have the need for one of the fields to contain text which is in HTML format (ie.

This is my paragraph

).

Document pdfDocument = new Aspose.Pdf.Document(fileName);

TextBoxField text3 = pdfDocument.Form["BodyContent"] as TextBoxField;

text3.Value = "

This is my paragraph

"

pdfDocument.Save(newFileName);

How can I get the textfield to format the value to it's HTML equivalent?

Hi there,


Thanks for your inquiry. I’m afraid currently Aspose.Pdf doesn’t support text, containing HTML formatting, as a value in TextBoxField. However I have logged the issue as, PDFNEWNET-34834, in our issue tracking system for further investigation and resolution. We will keep you updated via this forum thread regarding issue progress.

Please feel free to contact us for any further assistance.

Best Regards,

Hi,


Thanks for your patience.

We have further investigated the issue reported earlier and we have made some progress towards its resolution. Please note that in order to assign formatted text to text box field, this text box field must be RichTextBoxField. RValue property of RichTextBoxField is describes formatted (XML) text of the field.

[C#]

Document doc = new
Document(“c:/pdftest/HeightIssue.pdf”);<o:p></o:p>

//add new rich text box field to document:

RichTextBoxField rt = new RichTextBoxField(doc.Pages[1], new Aspose.Pdf.Rectangle(50, 600, 250, 650));

rt.PartialName = "rt";

doc.Form.Add(rt);

doc.Save("c:/pdftest/34834.pdf");


//set formatted value to rich text field:

Document doc1 = new Document("c:/pdftest/34834.pdf");

(doc1.Form["rt"] as RichTextBoxField).RValue = "

This is my paragraph

";

doc1.Save("c:/pdftest/RichTextBox_Filled_34834.pdf")

The issues you have found earlier (filed as PDFNEWNET-34834) have been fixed in Aspose.Pdf for .NET 7.8.0update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.