I am filling a RichTextBoxField programmatically by setting the FormattedValue to text with XML markup. I notice that when the PDF is opened and the field is selected, the formatting disappears and the text spacing expands to double spacing. When I deselect the field the formatting returns to expected. If I change a property on the field within Acrobat (e.g. field name or background color), the formatting is lost completely and the non-formatted, double-spaced text remains regardless of selection. I’ve tried setting the FormattedValue, RichTextValue, and Value to different things to attempt to prevent this from happening, but nothing has worked so far. Is anyone familiar with this issue? Any help would be greatly appreciated.
Would you kindly share the code snippet and input files that you are using to fill the form field in PDF document. We will test the scenario in our environment and address it accordingly.
Thanks for your response asad.ali, I appreciate your assistance. Here is a snippet of code being used to populate the field with the formatted text:
Dim template As String = Path.Combine(_RootPath, "MYPATHTOTEMPLATE")
Dim doc As Document = New Document(template)
Dim rtbfCostsJust As Forms.RichTextBoxField = Nothing
rtbfCostsJust = TryCast(doc.Form("PCSCOSTSJUSTCONTINUATION"), Forms.RichTextBoxField)
If (rtbfCostsJust IsNot Nothing) Then
rtbfCostsJust.FormattedValue = VALUE
End If
The value I am setting the FormattedValue to is the following:
"<?xml version=""1.0""?><body xfa:APIVersion=""Acroform:2.7.0.0"" xfa:spec=""2.1"" xmlns=""http://www.w3.org/1999/xhtml"" xmlns:xfa=""http://www.xfa.org/schema/xfa-data/1.0/"">Costs are justified for the following reasons:<br /><br /> •First reason<br /> •Second reason<br /> •Third reason<br /> •Fourth reason<br /><br />Here is some follow-up text about the four reasons why the costs are justified.<br /><span style=""font-weight:bold;"">A bold statement is made right here.</span><br /><span style=""font-weight:bold;"">This is an edit to the original2</span><br /><span style=""font-weight:bold;"">Here is an additional edit performed 08/13/2019 at 1124</span></body>"
We were able to notice the issue using Aspose.PDF for .NET 19.8 in our environment and logged an investigation ticket as PDFNET-46860 in our issue tracking system. We will further investigate this scenario in details and keep you posted with the status of ticket resolution. Please spare us little time.
We are sorry for the inconvenience.
Thank you for the prompt follow-up.
The issue is logged in our internal issue management system and we are afraid that you may not be able to track its status. However, as soon as some definite updates are available regarding its resolution or we need any feedback from your side, we will inform you within this forum thread.