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

Free Support Forum - aspose.com

Load License directly from buffer Aspose.PDF for C++

Hi, I an trying to load license from resources using an unsigned char* buffer but it throws the following exception System::ExceptionWrapper<System::Details_NullReferenceException> on second line.

auto m_Arr = MakeArray<uint8_t>(size, data);
auto m_StreamIn = MakeObject<System::IO::MemoryStream>(m_Arr, false);
m_StreamIn->Seek(0, System::IO::SeekOrigin::Begin);
auto m_License = MakeObject<Aspose::Pdf::License>();

data is unsigned char* containing license content

If i try to write the buffer in a temporary file and then load that file as license using the path works.
I would like to know if there is any solution to load license directly from buffer.
(I am using this version of aspose https://downloads.aspose.com/pdf/cpp/new-releases/aspose.pdf-for-c---19.11/ on 64x)


Thanks for contacting support.

We have generated an investigation ticket as PDFCPP-1157 in our issue tracking system for further investigation on this scenario. We will check this in details and keep you posted with the status of ticket resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.


In Aspose.PDF for C++ 20.3, this code works pretty well on valid license data.

auto ms = System::MakeObject<System::IO::MemoryStream>(System::IO::File::ReadAllBytes(LicenseFilePath)); 
auto lic = System::MakeObject<License>(); 

There can be possible errors (i.e. NullReferenceException) if stream contains incorrect data. In case you face similar issues, please share your license file in a private message. You can send a private message by clicking over username and pressing Blue Message Button.