Getting exception when calling PDFNet.Initialize a second time

We are encountering an issue with our web App that I hope you can help us out with. The issue seems to be that we are calling PDFNet.Initialize too many times within the same process.

Message: PDFNet is initialized in demo mode. Please make sure to call PDFNet.Initialize() only once.

This exception is actually caused when the first call to Initialize was with no license key, thus putting you into demo mode, and then you later call Initialize with a license key. Being in demo mode first can cause problems, such as injecting watermarks into output, or throwing exceptions when your trial period expires (or your clients trial period expires).

Also, Initialize into demo mode can be implicitly triggered, for example if you open a PDF before calling Initialize, that will implicitly put you into demo mode.

PDFDoc doc("my.pdf"); // enter demo mode, throws exception if trial period expired. PDFNet::Initialize("my_license_key"); // previous PDFNet versions ignored this, now we throw an exception.

So please do the following

  1. Make sure any calls to PDFNet.Initialize use your license key.

  2. Make sure no calls to the PDFNet library occur before a call to Initialize.

  3. Make sure that you are not loading another library which utilizes the PDFNet SDK.