using iTextSharp.text; using iTextSharp.text.pdf; Document doc = new Document(); PdfWriter.GetInstance(doc, new FileStream("output.pdf", FileMode.Create)); doc.Open(); // Add content to the document doc.Close();
PdfPTable table = new PdfPTable(2); table.AddCell(new PdfPCell(new Phrase("Cell 1"))); table.AddCell(new PdfPCell(new Phrase("Cell 2"))); doc.Add(new Paragraph("This is some text.")); doc.Add(table);
Image img = Image.GetInstance("image.jpg"); doc.Add(img);In these examples, we can see that the iTextSharp.text package is being used to create and manipulate PDF documents. The Document class is a central part of this library and provides a simple way to create new documents and add content to them.