I tried to generate a simple PDF using ITEXT 7 package. I just copy the source code from the documentation page and tried to run the .Net Core Console Application. It throws an exception. I'm not sure what I missed. I tried a lot to fix the issue but failed.
Package Info: Name: itext7 Version: 7.1.16
Exception Message:
Ex Message "Object reference not set to an instance of an object." string
ITEXT Documentation: https://itextpdf.com/en/products/itext-7/itext-7-core
class Program { static void Main(string[] args) { PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new FileStream("G:/hello.pdf", FileMode.Create, FileAccess.Write))); Document document = new Document(pdfDocument, iText.Kernel.Geom.PageSize.A4); String line = "Hello! Welcome to iTextPdf"; var para = new Paragraph(line); document.Add(new Paragraph(line)); document.Close(); Console.WriteLine("Awesome PDF just got created."); Console.WriteLine("Hello World!"); } } 