Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Jan 27, 2022 4:05 pm

Object reference not set to an instance of an object.

StackTrace:

at spr⭞.ᜁ(Graphics A_0, spr⭛ A_1, Boolean A_2, Boolean A_3)
at spr⭛.ᜀ(String A_0, spr⮾ A_1, String A_2, Boolean A_3)
at spr⭛.ᜀ(String[] A_0, String A_1)
at spr⭛.ᜀ(spr⯁ A_0)
at spr⭛.᜼()
at spr⭛.ᜍ(Boolean A_0)
at spr⯐.ᜀ(Graphics A_0, spr⯀ A_1, spr⭛ A_2)
at spr⭛.ᜂ(String[] A_0)
at spr⭛.ᜀ(spr⯁ A_0)
at spr⭛.᜼()
at spr⭛.ᜍ(Boolean A_0)
at sprᣫ.ᜀ(Graphics A_0, spr⭒ A_1, spr⯀ A_2, spr⯂ A_3, Image A_4)
at Spire.Pdf.PdfDocument.ᜂ(Object A_0)
at Spire.Pdf.PdfDocument.ᜁ(Object A_0)
at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()

Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromBytes(System.IO.File.ReadAllBytes(file));
doc.PageSettings.Orientation = Spire.Pdf.PdfPageOrientation.Landscape;

System.Drawing.Printing.PrintDocument printDoc = doc.PrintDocument;
if (printerSettings != null)
{
printDoc.PrinterSettings = printerSettings;
}
printDoc.Print();


I am not able to attach the PDF file as it is 5MB & 15 MB- the file attachments to the support forum are limited to 2 MB

[email protected]
 
Posts: 2
Joined: Thu Mar 09, 2017 3:15 pm

Fri Jan 28, 2022 3:00 am

Hello,

Thanks for your inquiry!

For the 4.8MB file, I did meet the issue "System.NullReferenceException" when I print it, And I have logged it in our issue tracking system with the ticket SPIREPDF-4927 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

For the 14.3MB file, I can print it after about 4 minutes. I am using the latest Spire.PDF 8.1.4 and printing it to Microsoft XPS Document Writer for testing. Do you mean that you need to optimize the printing speed? If not, please provide us with your project type(E.g. console app) and target framework (E.g. .net 5.0) for further investigate. Thanks in advance!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Mar 23, 2022 7:27 am

Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:8.3.9 which fixes the issue with SPIREPDF-4927.
Please download the new version from the following links to test.

Website link: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/8.3.9

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF