1

Using IronPDF, I need to fill in a PDF Form Text Field with a multiline string. A single string works fine, but using Environnment.NewLine adds a symbol; \n and \r\n are displayed as text.

I need to avoid modifying the PDF in any way.

'Example that isn't working
Dim pdf = PdfDocument.FromFile("mypdf.pdf")
pdf.Form.Fields(0).Value = "A string with" & Environment.NewLine & "multiple lines"

Thanks in advance!

Michael
  • 2,825
  • 3
  • 24
  • 30

1 Answers1

2

The solution I found was applying the new line in the HTML:

<div>
    @{
        var text = @Model.Value.Split("\n");
        foreach (string line in text)
        {
            @line.ToString();
            <br />
        }
    }
</div>
Anton Krug
  • 1,555
  • 2
  • 19
  • 32
irenecrdz
  • 21
  • 3