Aspose.Words lisence error


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();
doc.Save(stream, SaveFormat.FormatAsposePdf);
stream.Seek(0, SeekOrigin.Begin);

Aspose.Pdf.Pdf pdf = new Pdf();
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.BindXML(stream, null);

MemoryStream ms = new MemoryStream();

pdf.Save(ms); // this line throws an exception if lisence for Aspose.Words is set.

return ms.GetBuffer();
catch (Exception ex)
return null;

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?


The problem lies in Aspose.Pdf somwhere. I will move this thread to Aspose.Pdf forum. Members of Aspose.Pdf team will answer you shortly.

Best regards,


Thanks for considering Aspose.

Please provide your license to me at

We will investigate it and answer you ASAP.


Hi LevV,

Thanks for considering Aspose.

I just tested your lic, codes and got a correct result PDF document. So what verion of Aspose.Pdf did you use?

If not the latest release, please update to Aspose.Pdf v3.1.6.0 for avoiding unexpected errors.