We have lisences for Aspose.Pdf and Aspose.Words. This is how the licenses are set in the constructor of the class:
Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
Aspose.Words.License wordLicense = new Aspose.Words.License();
However, when a method residing in the same class is called, the null reference exeption is thrown. If I comment out the part that sets up Aspose.Words lisence, no exception is thrown but the generated PFD has garbage text inserted by Aspose.Words.
Here is the body of the method (lisences are set up in the constructor before the method is called):
private static byte GeneratePdf(Aspose.Words.Document doc)
MemoryStream stream = new MemoryStream();
Aspose.Pdf.Pdf pdf = new Pdf();
pdf.IsImagesInXmlDeleteNeeded = true;
MemoryStream ms = new MemoryStream();
pdf.Save(ms); // this line throws an exception if lisence for Aspose.Words is set.
catch (Exception ex)
Exception source: Aspose.Pdf
Exception message: Object reference not set to an instance of an object.
Can it be that the lisence is invalid or we are missing something here?