We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Null Object Exception when Clearing PDF Info

Hi there,

I’ve come across what appears to be a fundamental issue with the PDF library, unless I am using it wrong, but the documentation on this seems lacking so I’m not too sure.

I’m attempting to clear the document properties of a PDF file before applying my own at a later time, the issue at present is that I am getting a NULL Object exception when I try and call the ClearInfo() method from the PdfFileInfo variable.

After taking a look through what little documentation I can find, there is nothing to show how I can check for the presence of this metadata so there seems to be little I can do to prevent this error from being thrown, that being said, I would have imagined this should be better handled within the PDF library itself?

I’ve attached the document in question and my sample code is below for replicating, can someone take a look into this and let me know if there is a way to resolve this.

Many thanks


namespace PDFNullException
class Program
static void Main(string[] args)
var lic = new License();

Document pdf = new Document(@“C:\Users\Jak\Documents\DocumentClassifier\test.pdf”);

PdfFileInfo fi = new PdfFileInfo();
catch(Exception ex)

Hi Jak,

for using our API’s.

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this problem as PDFNEWNET-38834 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Hi Nayyer,

Further to the bug above, I believe I have uncovered yet another issue with the PDF metadata.

If I try and add a new custom tag it also fails with a null reference exception.


From the looks of this and the issue above there seems to be something seriously wrong with the current library’s handling of metadata. I can understand the bug above but surely simply setting a custom property should be causing such an exception?

Would you be able to advise a rough ETA on when I can expect the bug above and this bug, if confirmed, to be fixed?

Many thanks

Hi Jak,

Thanks for sharing the details.

I have tested the scenario and have managed to reproduce the same issue that when trying to set the MetaData information for PDF file, a NullReferenceException is being generated. For
the sake of correction, I have separately logged it in our issue tracking system as PDFNEWNET-38855. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.


Any update as to when PDFNEWNET-38855 will be resolved - we just came across it outselves

Hi Brian,

Thanks for contacting support.

I am afraid the earlier reported issue is not yet resolved as we have been busy fixing other previously reported high priority issues. However I have intimated the product team to evaluate the issue and try accommodating it in development schedule. As soon as we have some further updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-38834) have been fixed in Aspose.PDF for .NET 21.1.

The issues you have found earlier (filed as PDFNET-38855) have been fixed in Aspose.PDF for .NET 22.3.