facebooktwittermenuarrow-up

GemBox Support Forum

Exception When Printing

I am using version 13.0.35.1100 of Gembox.Pdf. I am trying to print a PDF I got from a third-party and am getting an error. Details below. I need these files to be able to print.

I wrote a small app and all I am doing is loading the file into a PdfDocument and printing it with my default printer name:

Code:

public void Print(string fileName)
{
	PdfDocument pdf = PdfDocument.Load(fileName);
	pdf.Print(PrinterName);
}

Exception:

Object reference not set to an instance of an object.

StackTrace

at .(​ , )
at .(​ , )
at .(PdfTextContent , )
at .(PdfTextContent , )
at .(PdfTextContent , )
at .(PdfContentGroup , )
at .(PdfPage , )
at .(PdfPage , DrawingContext , )
at GemBox.Pdf.PdfDocument.ktm3ttmlywtl2umptgpdf3th2yxdf47r (Int32 , Object , Object )
at ​ .( , Int32 , Object )
at ​ ..GetPage(Int32 )
at System.Windows.Xps.Serialization.Toolbox.GetPage(DocumentPaginator paginator, Int32 index)
at System.Windows.Xps.Serialization.XpsOMDocumentPaginatorSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
at System.Windows.Xps.Serialization.XpsOMDocumentPaginatorSerializer.SerializeObject(Object serializedObject)
at System.Windows.Xps.Serialization.XpsOMSerializationManager.SaveAsXaml(Object serializedObject)
at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)
at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator, PrintTicket printTicket)
at ​ .. ( )
at ​ .​ ( , String , Stream )
at GemBox.Pdf.PdfDocument.Print(String printerName, PrintOptions options)
at GemBox.Pdf.PdfDocument.Print(String printerName)
at Testing.Program.PdfPrint.Print(String fileName) in U:\Testing\Testing\Program.cs:line 682

StackTrace (raw)

" at \u000e .\u0005(\u0003​ \u0002, \u000f \u0003)\r\n at \u000e .\u0003(\u0003​ \u0002, \u000f \u0003)\r\n at \u000e .\u0005(PdfTextContent \u0002, \u000f \u0003)\r\n at \u000e .\u0003(PdfTextContent \u0002, \u000f \u0003)\r\n at \u000e .\u0002(PdfTextContent \u0002, \u000f \u0003)\r\n at \u000e .\u0002(PdfContentGroup \u0002, \u000f \u0003)\r\n at \u000e .\u0003(PdfPage \u0002, \u000f \u0003)\r\n at \u000e .\u0002(PdfPage \u0002, DrawingContext \u0003, \u000f \u0005)\r\n at GemBox.Pdf.PdfDocument.ktm3ttmlywtl2umptgpdf3th2yxdf47r \u0002(Int32 \u0002, Object \u0003, Object \u0005)\r\n at \u0006​ .\u0003(\u0006 \u0002, Int32 \u0003, Object \u0005)\r\n at \u0006​ .\u0003.GetPage(Int32 \u0002)\r\n at System.Windows.Xps.Serialization.Toolbox.GetPage(DocumentPaginator paginator, Int32 index)\r\n at System.Windows.Xps.Serialization.XpsOMDocumentPaginatorSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)\r\n at System.Windows.Xps.Serialization.XpsOMDocumentPaginatorSerializer.SerializeObject(Object serializedObject)\r\n at System.Windows.Xps.Serialization.XpsOMSerializationManager.SaveAsXaml(Object serializedObject)\r\n at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)\r\n at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator, PrintTicket printTicket)\r\n at \u000f​ .\u0002.\u0002 \u0002(\u0006 \u0002)\r\n at \u0006​ .\u0005​ \u0002(\u0006 \u0002, String \u0003, Stream \u0005)\r\n at GemBox.Pdf.PdfDocument.Print(String printerName, PrintOptions options)\r\n at GemBox.Pdf.PdfDocument.Print(String printerName)\r\n at Testing.Program.PdfPrint.Print(String fileName) in U:\Testing\Testing\Program.cs:line 682" string

Origin?:
System.Windows.Media.GlyphTypeface

Hi,

I was unable to reproduce this issue.

Please try again with the latest BugFix version (Full version: 17.0.35.1059).
I’ll send you a time-limited serial key so that you can try out this version.

If the problem remains, please send us your PDF so that we can reproduce this issue and investigate it.

Regards,
Mario