Adding a New Line in iTextSharp

后端 未结 10 1705
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 00:36

I’ve been trying to solve this problem for a while now to no avail. I have some text in iTextSharp I’m trying to put on a newline. I’ve tried using the \\n escape c

10条回答
  •  一生所求
    2021-02-19 01:20

    Maybe it's an iText 7 thing (which is the version I am using), but the suggestions above did not work for me. What did was:

    PdfDocument pdfDoc = new PdfDocument(new PdfWriter(dest));
    Document doc = new Document(pdfDoc);
    Paragraph p = new Paragraph();
    . . .
    p.Add("WHEELWORK!");
    p.Add("\n\n"); // break two lines
    p.Add("Ezekiel's Vision");
    p.Add("\n"); // break one line
    . . .
    doc.Add(p);
    

提交回复
热议问题