How to fill a PDF form with Rich Text/XML?

In a UWP program, I am trying to fill a pre-made PDF form using Syncfusion's PDF library.

I fill text fields using the following line: (form.Fields["Date"] as PdfLoadedTextBoxField).Text = date; //date is a string

This works so far.

The rest of the text in the PDF has a custom letter-spacing, which I would like to match in the date as well. In order to accommodate Rich Text, I have enabled this option when preparing the form in Acrobat Pro DC.

The format I would use 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/">
<p dir="ltr" style="letter-spacing: -0.04cm; margin-top:0pt;margin-bottom:8pt;line-height:12.95pt;font-family:Calibri;font-size:11pt">Sample text</p>
</body>

In case I fill in this code to Acrobat Pro DC as the Default text, the formatting works just fine. As soon as I enter this code manually to the form, it just shows the code; the same happens when I use the C# code above.

What is the proper way of filling this code to the PDF?


2 Replies

SL Sowmiya Loganathan Syncfusion Team August 13, 2020 11:06 AM UTC

Hi Balazs,    
  
Thank you for contacting Syncfusion support.    
  
We have analyzed your requirement “Fill textbox field with RTF text in PDF document” and at present, we do not have support for this. Currently, we are validating on this and will update the further details on August 17, 2020.    
  
However, could you please provide us the PDF document with filling the form of RTF text/XML. It will helpful for further investigation and provide a better solution to this.    
 
Regards, 
Sowmiya Loganathan 
 



GK Gowthamraj Kumar Syncfusion Team August 17, 2020 01:41 PM UTC

Hi Balazs, 

Thank you for your patience. 
 
On our further analysis, we have considered this requirement as a feature with “Support to set RTF text as PdfTextBox Field value in PDF document” and we have created a feature request for this requirement. And we do not have any immediate plan to implement this feature. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases, at the planning stage of every release cycle, will review all the open features and we will notify you once this support is included.    
   
You can track the status of the implementation in the below feedback.    

Regards, 
Gowthamraj K 


Loader.
Up arrow icon