Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Read the complete article to converting PUB to Word document (DOC/DOCX) using C++ by visiting the following link.
// Source PUB and output PDF file paths
System::String filePub = u"SourceDirectory\\";
System::String filePdf = u"OutputDirectory\\1.pdf";
// Load the PUB file
System::SharedPtr<IPubParser> parser = PubFactory::CreateParser(filePub);
System::SharedPtr<Aspose::Pub::Document> document = parser->Parse();
// Convert the PUB file to PDF
PubFactory::CreatePdfConverter()->ConvertToPdf(document, filePdf);
// Load the generated PDF file
auto pdfDocument = MakeObject<Aspose::Pdf::Document>(filePdf);
// Create an instance of the DocSaveOptions class
auto saveOptions = MakeObject<Aspose::Pdf::DocSaveOptions>();
// Set the format as DocX
// Save the DocX file
pdfDocument->Save(u"OutputDirectory\\PubToDocx.docx", saveOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment