Adding a New Line in iTextSharp

后端 未结 10 1680
伪装坚强ぢ
伪装坚强ぢ 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

    document.Add(new Paragraph("\n"));
    

    EDIT:

    cb.BeginText();
    string text = "";
    text = "F\n";           
    text += "o\n";            
    text += "o";
    cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text, 85, 311, 0);
    cb.EndText();
    
    
    //Create the new page
    PdfImportedPage page = writer.GetImportedPage(reader, 1);
    cb.AddTemplate(page, 0, 0);
    
    Paragraph p = new Paragraph(text);
    document.Add(p);
    
    //Close all streams
    document.Close();
    fs.Close();
    writer.Close();
    reader.Close();
    

提交回复
热议问题