Read and Write Rich text in form field using Aspose.PDF for .NET and submit PDF

Hello,

Please, can someone help me with two questions about Aspose.Pdf.Kit features:

1) It's possible to have a form field that can accept and show HTML content? Like a text box in a PDF document that I can put some text with HTML tags and that Aspose.Pdf.Kit could read (or write) knowing that this content is, in fact, HTML?

2) Are there any means to read or write a rich content from a text box with Aspose.Pdf.Kit? I created a text box and marked it to allow rich content. I can make the text bold but when I use the GetField() method, Aspose returns the text withtout any format. To write, the same problem. If I use the FillField() method to send a XML string it is represented as a normal string.

The only way I can read the formatting in these fields is submitting the form to the server. But to write to it I dind't found anything.... Are there any others ways to workaround those problems to work with rich content with Aspose.Pdf.Kit?

Thank you!

Regards,

André

Hi André,

Can you please share the code snippet and the PDF file along with the description of what you're trying to achieve? That'll help us understand the requirement in a better way and help you out.

We're sorry for the inconvenience.

Regards,

Hello,

Thanks for your help! I've attached a sample application (VS 2008, .NET Framework 3.5 SP1, Aspose.Pdf.Kit 3.4.0.0). I've a pdf document (pdfDoc.pdf) in this application that I created with Adobe Acrobat 8.1. This document has two form fields: one that allows rich text format values and another that doesn't. You can open the document and see that in the form field that allows rich text format values I've a text with bold, underline and others format options enabled. The other field has a normal text value.

You can run the sample web application and browse to Default.aspx. You will have three choices (links):

1) . Read rich text field value with Aspose.Pdf.Kit
2) . Write rich text value with Aspose.Pdf.Kit
3) . Open the pdf document to submit

The first option read the document with Aspose.Pdf.Kit and tries to get the rich text value with a call to the method GetValue(). After that, the value is showed. Here I've my first problem: I can't get the rich text value from the field (I only get the normal, unformatted string).

The second option opens the document with Aspose.Pdf.Kit and tries to write a rich text value (XML) to the form field with a call to the method FillField(). After that, the resulting document is showed. My second problem: My rich text value is showed as a normal string, and not considered as a true rich value. But if you click inside the form field, the formatted string will show correctly!! And if you click outside, the XML string will appear again! That's weird! If you click inside and edit the value (add a space or something like that), it will remain as a true rich text value.

The third option shows the pdf document. Here I'd like to show that when clicking in the submit button of the document you will get the XML string for the form field that allows rich text format. Entering something like that in the form field

Rich Text

will allow me to get the following XML string after a submit:

<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="margin-top:0pt;margin-bottom:0pt;font-family:Helvetica;font-size:12pt;font-weight:bold">Rich Text</p></body>

So, my requirement is: I'd like to take the text entered in a form field that allows rich text format to save it in a database. So I must save the original XML string generated by Adobe. And I must also read the value from my database and show it in the pdf document with the original format. With Aspose.Pdf.Kit I can't read the rich text value from a form field (the XML string). And to write the value to a form field with the FillField() method, that's seems unsupported because the XML string is written as a normal text and Adobe doesn't appears to accept it very well as the sample application shows.

In short, are there any means with Aspose.Pdf.Kit to read and write rich text values to and from a form field?

If you need more information just let me know, ok?

Thank you very much for your time.

Regards,

André Machado

Hi André,

I have noticed the issues you mentioned. I have logged it as PDFKITNET-9261 in our issue tracking system. Our development team will be looking into the issue and you'll be updated accordingly via this forum.

We appreciate your patience.

Regards,

Hello,

Thank you very much for your feedback. I'll wait for an answer.

Regards,

André

Dear André,

Thanks for considering Aspose.Pdf.Kit.

Frankly speaking, Rich Text cannot be supported by Kit. We are investigating into this problem to decide whether the feature can be supported or not. Thanks for your patience.

Best regards.

Hello,

Thank you very much! Hope to hear good news :-)

Regards,

André

We would like this feature too.

Hi Nick,

Thank you very much for considering Aspose.

Team is looking into the requirement and you'll be updated via this forum about the availability of this feature.

Regards,

Dear Customers,

Thanks for your patience.

Till now, the functionof getting value of RichTextField has been accomplished. However, the function of filling RichTextField is rather more difficult than we estimated before. We'll keep on looking at it and update this issue when any progress is made.

Best regards.

Thank you Luke.

Hope to hear you again with good news :-)

Regards,

André

The issues you have found earlier (filed as 9261) have been fixed in this update.


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

Dear André,

Please try the function Form.GetRichText() to obtain rich text value from the existing field. The bad news is that the function of setting rich text value won't be available in a short time.

Sorry for the inconvenience & Best regards.

Thank you Luke. The new GetRichText method will be really usefull!

Regards,

André

The issues you have found earlier (filed as PDFNEWNET-9261) have been fixed in this update.


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