Issue to PDF file

Peter_1985 2,466 Reputation points

Good day,
Is there one better example to create PDF file? I used code below and PDF file then is empty (cannot be opened).
PdfWriter pdfWriter = new PdfWriter("f:\l0\A0.pdf");
PdfDocument pdfD0 = new PdfDocument(pdfWriter);
Document D0 = new Document(pdfD0);

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,806 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,635 questions
{count} votes

9 additional answers

Sort by: Most helpful
  1. Peter_1985 2,466 Reputation points

    Thanks to all.
    Is there example/details to put text at specific position within PDF file? And example to create rectangle in that.

  2. Peter_1985 2,466 Reputation points

    Thanks a lot.
    Last issue is, what should be the size same as one A4 paper size? How to adjust the following to have A4 paper size?

    Document D0 = new Document(pdfD0, new PageSize(900f, 670f));

  3. Peter_1985 2,466 Reputation points

    Sorry, other than the following, is there one full example to do update into every position of the page?

            Document D0 = new Document(pdfD0, PageSize.A4);
            D0.SetMargins(40, 40, 40, 40);
            Paragraph paragraph = new Paragraph(new Text("testing b\n"));
            paragraph.SetFixedPosition(10, 50, 210);
            paragraph.SetBorder(new iText.Layout.Borders.SolidBorder(2));
    0 comments No comments

  4. Peter_1985 2,466 Reputation points

    Can you see this if available?

    0 comments No comments