locked
pdf document how to insert empty line RRS feed

  • Question

  • User1472402676 posted

    I fond solution this link but not working:

    http://stackoverflow.com/questions/4158336/how-to-insert-blank-lines-in-pdf-using-itext

    Monday, March 30, 2015 8:04 AM

All replies

  • User-821857111 posted

    The solution you found is for the Java version. You need C# code:

    Document document = new Document();
    var path = Path.Combine(Server.MapPath("~/", "AddBlankLine.pdf");
    using (FileStream fileStream = new FileStream(path, FileMode.Create))
    {
        PdfWriter writer = PdfWriter.GetInstance(document, fileStream);
        document.Open();
    
        document.Add(new Paragraph("Hello, World!"));
        document.Add(new Paragraph("Hello, World!"));
    
        // add a couple of blank lines
        document.Add(Chunk.NEWLINE);
        document.Add(Chunk.NEWLINE);
    
        // add one more line with text
        document.Add(new Paragraph("Hello, World!"));
    
        document.Close();
    }

    Monday, March 30, 2015 8:23 AM
  • User1472402676 posted

    Yes i need in c#.

    I am also read your artical (http://www.mikesdotnetting.com/article/82/itextsharp-adding-text-with-chunks-phrases-and-paragraphs) but, i can't found.

    Monday, March 30, 2015 8:28 AM
  • User-821857111 posted

    Yes i need in c#.

    I posted C# code for you. I tested it and it works.

    Monday, March 30, 2015 9:05 AM
  • User1472402676 posted

    Sorry 

    Mikesdotnett.

    I can't found wwhich is correct so can u replay that code....

    Monday, March 30, 2015 9:57 AM
  • User-821857111 posted

    It's in my first reply to your question. 

    Monday, March 30, 2015 10:40 AM