Issue to PDF file

Scott Huang 3,491 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);

Developer technologies | Windows Forms
Developer technologies | Windows Presentation Foundation

Answer accepted by question author
Castorix31 91,906 Reputation points
2020-10-23T08:09:48.917+00:00

Did you see the various samples, like

Using C# and iTextSharp to create a PDF

Was this answer helpful?

0 comments No comments

9 additional answers

Sort by: Most helpful
  1. Scott Huang 3,491 Reputation points
    2020-12-04T08:42:16.223+00:00

    Sir,
    Can you see this if available?

    Was this answer helpful?

    0 comments No comments

  2. Scott Huang 3,491 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);
    

    Was this answer helpful?

    0 comments No comments

  3. Scott Huang 3,491 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));

    Was this answer helpful?


  4. Scott Huang 3,491 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.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.