Created
April 10, 2020 12:20
-
-
Save aspose-com-gists/646412e3cb84d611ef4cb124f9c683c6 to your computer and use it in GitHub Desktop.
Convert Word to PDF in C++
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
// Load the document from disk. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>( u"Word.docx"); | |
// Set the output PDF path | |
System::String outputPath = u"DOCX-to-PDF.pdf"; | |
// Set PDF options | |
System::SharedPtr<PdfSaveOptions> options = System::MakeObject<PdfSaveOptions>(); | |
// Set JPEG quality | |
options->set_JpegQuality(100); | |
// Save the document in PDF format | |
doc->Save(outputPath, options); |
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
// Load the document from disk. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>( u"Word.docx"); | |
// Set the output PDF path | |
System::String outputPath = u"DOCX-to-PDF.pdf"; | |
// Convert DOCX to PDF | |
doc->Save(outputPath); | |
std::cout << "Converted DOCX to PDF successfuly."; |
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
// Load the document from disk. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>( u"Word.docx"); | |
// Set the output PDF path | |
System::String outputPath = u"DOCX-to-PDF.pdf"; | |
// Set PDF options | |
System::SharedPtr<PdfSaveOptions> options = System::MakeObject<PdfSaveOptions>(); | |
options->set_PageIndex(1); | |
options->set_PageCount(2); | |
// Save the document in PDF format. | |
doc->Save(outputPath, options); |
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
// Load the document from disk. | |
System::SharedPtr<Document> doc = System::MakeObject<Document>( u"Word.docx"); | |
// Set the output PDF path | |
System::String outputPath = u"DOCX-to-PDFA.pdf"; | |
// Set PDF options | |
System::SharedPtr<PdfSaveOptions> options = System::MakeObject<PdfSaveOptions>(); | |
options->set_Compliance(PdfCompliance::PdfA1a); | |
// Save the document in PDF format. | |
doc->Save(outputPath, options); | |
std::cout << "Converted DOCX to PDF/A successfuly."; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment