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

Free Support Forum - aspose.com

How to Get Progress during PDF Excel or PPT Conversion in C++ | Aspose.PDF

hai,I find pdf cover doc can set CustomProgressHandler but excel or ppt has no handle
what can I do get the customProgresshandler

@mofeiwozl

Please check following example which can be used to track the conversion progress using Aspose.PDF for C++:

void ConversionProgressCallback(SharedPtr<UnifiedSaveOptions::ProgressEventHandlerInfo> eventInfo)
{
    String eventType;
    switch (eventInfo->EventType)
    {
    case ProgressEventType::ResultPageCreated:
        eventType = u"ResultPageCreated";
        break;
    case ProgressEventType::ResultPageSaved:
        eventType = u"ResultPageSaved";
        break;
    case ProgressEventType::SourcePageAnalysed:
        eventType = u"SourcePageAnalysed";
        break;
    case ProgressEventType::TotalProgress:
        eventType = u"TotalProgress";
        break;
    }
    Console::WriteLine(String::Format(u"Event type: {0}, Value: {1}, MaxValue: {2}", eventType, eventInfo->Value, eventInfo->MaxValue));
}

using ProgressHandler = System::MulticastDelegate<void(SharedPtr<UnifiedSaveOptions::ProgressEventHandlerInfo>)>;

void ConvertProgressExample()
{
    auto doc = MakeObject<Document>();
    auto pages = doc->get_Pages();
    for (int i = 0; i < 10; i++)
    {
        auto page = pages->Add();
        auto paragraps = page->get_Paragraphs();
        paragraps->Add(MakeObject<TextFragment>(String::Format(u"Page {0}", i)));
    }

    auto saveOptions = MakeObject<DocSaveOptions>();
    saveOptions->set_Format(DocSaveOptions::DocFormat::DocX);
    saveOptions->set_Mode(DocSaveOptions::RecognitionMode::Textbox);
    saveOptions->CustomProgressHandler = ProgressHandler(ConversionProgressCallback);
    doc->Save(u"ConvertProgressExample.docx", saveOptions);
    Console::WriteLine(u"ConvertProgressExample finished.");
}