using (var document = new Document()) { PdfWriter.GetInstance(document, new FileStream("example.pdf", FileMode.Create)); if (!document.IsOpen()) document.Open(); // Add content to the document }
using (var document = new Document()) { PdfWriter.GetInstance(document, new FileStream("example.pdf", FileMode.Create)); if (!document.IsOpen()) document.Open(); // Add content to the document if (document.IsOpen()) document.Close(); }The package library used in these examples is iTextSharp.