PDF C++ 19.1 ConvertToDOCX failed


#1

As the topic, conver to doc/docx failed,
code:

int main() {
try {
auto lic = MakeObject<Aspose::Pdf::License>();
lic->SetLicense(u"F:\Desktop\Aspose.Pdf.lic");
lic->set_Embedded(true);
} catch (const System::Exception& e) {
std::string message = e.get_Message().ToUtf8String();
std::cout << message << std::endl;
} catch (…) {
std::cout << “Whatever” << std::endl;
}

try {
auto doc1 = MakeObject<Aspose::Pdf::Document>(u"F:\Desktop\fuck.pdf");
auto saveOptions = MakeObject<Aspose::Pdf::DocSaveOptions>();
saveOptions->set_Format(DocSaveOptions::DocFormat::DocX);
saveOptions->set_Mode(DocSaveOptions::RecognitionMode::Flow);
doc1->Save(u"output.docx", saveOptions);
} catch (const System::Exception& e) {
std::string message = e.get_Message().ToUtf8String();
if (message.empty()) message = e.get_Message().ToAsciiString();
if (message.empty()) message = e.what();
std::cout << message << std::endl;
} catch (…) {
std::cout << “Whatever” << std::endl;
}

return 0;
}

throw exception “System::ArgumentOutOfRangeException”


#2

@LittleKu

Would you kindly share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.


#3

aspose.com.pdf (154.9 KB)


#4

@LittleKu

We are testing the scenario and will get back to you shortly.


#5

@LittleKu

We have tested the scenario in our environment using Aspose.PDF for C++ 19.6 and were unable to notice any issue like you have mentioned. Could you please try using latest version of the API and in case you still face any issue, please feel free to let us know.