facebooktwittermenuarrow-up

GemBox Support Forum

NullReferenceException when converting document to image

When following this example Convert Word files to image formats in C# and VB.NET I am getting a NullReferenceException on;

document.Save("Output.png", imageOptions);

This is the StackTrace of the exception:

NullReferenceException

at .(ParagraphFormat , CharacterFormat , CharacterFormat , Element , Boolean , , )
at .()
at .(IEnumerabl`1 , Boolean , Boolean , Int32& )
at .(Paragraph , , Boolean , , Int32& )
at .(IList`1 , )
at .(HeaderFooter )
at .(HeaderFooter , HeaderFooter , HeaderFooter , Boolean& , Boolean& )
at .(Section )
at .()
at GemBox.Document.DocumentModel.(PaginatorOptions , )
at GemBox.Document.ImageSaveOptions.67tg5rkvl9zwp8v7723mndgzuc3b4vj8 (DocumentModel , Stream , String )
at GemBox.Document.DocumentModel.Save(Stream stream, SaveOptions options)

It seems to be related to something with format maybe?

Anyone that can help guide me in the right direction?

Edit: Using version 33.0.1086

Hi,

Unfortunately, I was unable to reproduce this issue.

I’m afraid that the problem is specific to your input document.
So, can you send it to us?

We’ll try to reproduce this issue with it and resolve the problem.

Regards,
Mario