您好,
我使用Aspose.PDF for C++库,在VS2017环境,使用MTd方式加载Aspose库,Debug环境下会出现断言错误,使用的代码如下:
int GetPDFPages(const std::wstring& strFilePath, const std::wstring& strPassword)
{
int nPages = 0;
try
{
System::String strDocument(strFilePath.c_str(), strFilePath.length());
System::String strDocumentPassword(strPassword.c_str(), strPassword.length());
if (!System::IO::File::Exists(strDocument))
{
return Aspose_FileNotExist;
}
auto extractor = System::MakeObject<Aspose::Pdf::Facades::PdfExtractor>();
extractor->set_Password(strDocumentPassword);
extractor->BindPdf(strDocument);
nPages = extractor->get_EndPage();
}
catch (...)
{
return Aspose_PasswordError;
}
return nPages;
}
该段代码目的是获取PDF总页数,断言错误截图如下:
断言错误.png (6.5 KB)
这个断言错误如何解决呢?