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 13, 2022 8:56 am

I am using Spire.PDF with .NET to fill in a pdf template file and I am doing the following - take the user input from a field in a webform; this input is a numbered list of items (entered in a single textbox, for example "1.Some company LTD 2.Update xyz 3. London, UK").
The target field in the PDF that will be populated with this text is currently a text field with multiple (independent) line artefacts. Now, what I am trying to achieve is have the application render a line artefact for each numbered item in that input list (3 in the example above) and then align text on it. Is this possible with this library?
Thank you

iceblue24
 
Posts: 1
Joined: Wed May 11, 2022 9:02 am

Fri May 13, 2022 11:14 am

Hello,

Thanks for your inquiry.
Do you want to achieve the same effect as shown in the screenshot below. If so, you can refer to the following code. And if I misunderstand your requirement, to help us do an investigation and work out a solution for you, please offer a sample pdf file you want to achieve.
Thanks for your assistance in advance.


Code: Select all
PdfDocument pdf = new PdfDocument();

         PdfPageBase page = pdf.Pages.Add();
            pdf.AllowCreateForm = true;
            PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);

            PdfBrush brush = PdfBrushes.Black;
            string text = "1.Some company LTD \n2.Update xyz \n3. London, UK";
            PdfTextBoxField textbox = new PdfTextBoxField(page, "TextBox");
            textbox.Bounds = new RectangleF(10, 10, 100, 300);
            textbox.BorderWidth = 0.75f;
            textbox.BorderStyle = PdfBorderStyle.Solid;
            textbox.Multiline = true;
            textbox.Text = text;
            textbox.TextAlignment = PdfTextAlignment.Left;
            pdf.Form.Fields.Add(textbox);

            String result = "test.pdf";

            //Save the document
            pdf.SaveToFile(result);


Sincerely,
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 938
Joined: Tue Mar 08, 2022 2:02 am

Tue May 24, 2022 10:24 am

Hello,

Hope you are doing well.
Could you please let us know how is the issue going? Thanks in advance for your feedback and time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 938
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF