Issue to PDF file

Peter_1985 2,586 Reputation points
2020-10-23T07:28:47.507+00:00

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,873 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,710 questions
{count} votes

9 additional answers

Sort by: Most helpful
  1. Peter_1985 2,586 Reputation points
    2020-10-26T15:35:27.173+00:00

    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,586 Reputation points
    2020-10-31T14:26:08.783+00:00

    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,586 Reputation points
    2020-11-09T10:17:05.15+00:00

    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));
            D0.Add(paragraph);
    
    0 comments No comments

  4. Peter_1985 2,586 Reputation points
    2020-12-04T08:42:16.223+00:00

    Sir,
    Can you see this if available?

    0 comments No comments