Last active
July 29, 2021 19:24
-
-
Save aspose-com-gists/df85ab10987edad6def4555567c0ebb1 to your computer and use it in GitHub Desktop.
Convert PUB to Word Document (DOC/DOCX) using C++ | https://blog.aspose.com/2021/07/28/convert-pub-to-word-document-doc-docx-using-cpp/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read the complete article to converting PUB to Word document (DOC/DOCX) using C++ by visiting the following link. | |
https://blog.aspose.com/2021/07/28/convert-pub-to-word-document-doc-docx-using-cpp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source PUB and output PDF file paths | |
System::String filePub = u"SourceDirectory\\1.pub"; | |
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 | |
saveOptions->set_Format(DocSaveOptions::DocFormat::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