We tried consuming latest versions of Aspose.PDF (24.5.0, 24.6.0 and 24.7.0) in our managed c++ project to convert XPS document to PDF. It fails to compile following line of code. It’s not recognizing Document type.
bool PdfManipulatorWrapper::CreatePdfFromXPS(ProcObject::ptr obj, std::wstring inputFilePath, std::wstring outputFilePath)
{
try
{
if (!CheckAndSetAsposeLibLicence())
return false;
System::String^ sourceFilePath = gcnew System::String(inputFilePath.c_str());
System::String^ targetFilePath = gcnew System::String(outputFilePath.c_str());
Aspose::Pdf::Document^ document = gcnew Aspose::Pdf::Document(sourceFilePath, gcnew Aspose::Pdf::XpsLoadOptions());
document->Save(targetFilePath);
}
catch (…)
{
_errors.push_back(L"Unhandled exception in PDFManipulatorWrapper::CreatePdfFromXPS");
return false;
}
return true;
}
The error in VS 2022 output window…
2>…\Processor\PDFManipulatorWrapper.cpp(259): fatal error C1001: An internal error has occurred in the compiler.
2>(compiler file ‘f:\dd\vctools\compiler\cxxfe\sl\p1\c\cpimport.cpp’, line 16644)
2> To work around this problem, try simplifying or changing the program near the locations listed above.
2>Please choose the Technical Support command on the Visual C++
2> Help menu, or open the Technical Support help file for more information
2>…\Processor\PDFManipulatorWrapper.cpp(259): note: This diagnostic occurred while importing type 'Aspose::Pdf::Document ’ from assembly ‘Aspose.PDF, Version=24.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’.
The project is targetting .net framework 4.8.1 and asppose.pdf.dll it references comes from bin\4.8.1 folder of downloaded Aspose.pdf.
If i use 24.4.0 (v4.8.1) version, then same code compiles without these errors.
Can someone look into this and resolve this issue for us so we can upgrade to latest version?