Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri May 22, 2020 1:19 am

I need to fill an text box form field of my PDF file with HTMl text.
This fild is an PdfTextBoxFieldWidget object on a PDF form.

On my web site, I have an HTML text editor where users can write and aply style on their text, like bold text inside paragraphs, justified paragraphs, numerable lists and all.

I need to edit an PDF Document e put this HTML styled text on this text box field.
The structure of the document has already been definded, and I can't change it.
This structure is a form with some fields and I'm trying to fill this fields like this:

Code: Select all
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(sourceFilePath);

            PdfFormWidget formWidget = doc.Form as PdfFormWidget;

            var relatorio = (PdfTextBoxFieldWidget)formWidget.FieldsWidget["02_Relatório"];
            relatorio.Text = "<p> my firts paragraph </p> <br><br> <b>some bold text after firts paragraph</b>";

            doc.SaveToFile(outputFilePath);
            doc.Close();


This is the result of this code:

Image

And I was expecting something like this:

Image


Someone can help me ?

MiguelFaria
 
Posts: 1
Joined: Fri May 22, 2020 12:28 am

Fri May 22, 2020 6:47 am

Hello,

Thanks for your inquiry.
Sorry our Spire.PDF doesn't support filling text box field with html style string. If there is anything else we can do for you, just feel free to contact us.

Sincerely,
Rachel
E-iecblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF