linkedinfacebooktwittermenuarrow-up

GemBox Support Forum

Error priting pdf document

I’m evaluating your product and I’m trying to print a simple pdf document with your API using.
.net 5.0 console app
Gembox.PDF version 17.0.1158

Here’s the error:

System.NullReferenceException: Object reference not set to an instance of an object.
at :heart:↨☼:slight_smile:…ctor(☼▬:slight_smile::heart:→:slight_smile::slight_smile: :heart:, :slight_smile:↓→ :clubs:, Boolean)
at↨☼:slight_smile:.:slight_smile:(PdfPage :slight_smile:, DrawingContext :heart:, :spades:↨☼:slight_smile: :clubs:)
at GemBox.Pdf.PdfDocument.ktm3ttmlywtl2umptgpdf3th2yxdf47r↓►:slight_smile::slight_smile::slight_smile:(Int32 :slight_smile:, Object :heart:, Object :clubs:)
at ♫§→.:heart:(♫►→ :slight_smile:, Int32 :heart:, Object :clubs:)
at ♫§→.:heart:.GetPage(Int32 :slight_smile:)
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 :slight_smile:▬→.:slight_smile:.:slight_smile:↓►:slight_smile::slight_smile::slight_smile:(♫►→ :slight_smile:)
at ♫§→§→↓►:slight_smile::slight_smile::slight_smile:(♫►→ :slight_smile:, String :heart:, Stream :clubs:)
at GemBox.Pdf.PdfDocument.Print(String printerName, PrintOptions options)
at GemBox.Pdf.PdfDocument.Print(String printerName)

Here’s my code:

I’ve added usewpf set tot true and specifying the net version with windows like net5.0-windows7.0.

I would appreciate any help.
Patrick

Can you please us that “test.pdf” file so that we can try to reproduce this issue and investigate it?