Last active
March 26, 2023 11:24
-
-
Save aspose-com-gists/7291ec6e6426497c7788117d1199990c to your computer and use it in GitHub Desktop.
Word to PDF Conversions in C# | Aspose.Words for .NET
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
Document doc = new Document("word.docx"); | |
// Set PDFSaveOption compliance to PDF17 | |
PdfSaveOptions options = new PdfSaveOptions(); | |
options.Compliance = PdfCompliance.Pdf17; | |
// Convert Word to PDF | |
doc.Save("output.pdf", 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. | |
Document doc = new Document("word.doc"); | |
// Save as PDF | |
doc.Save("output.pdf"); |
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
Document doc = new Document("word.docx"); | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Digital signatures details | |
CertificateHolder certHolder = CertificateHolder.Create("signature.pfx", "12345"); | |
options.DigitalSignatureDetails = new PdfDigitalSignatureDetails(certHolder, "reason", "location", DateTime.Now); | |
// Save Word as PDF | |
doc.Save("output.pdf", 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
Document doc = new Document("word.docx"); | |
// Set Jpeg quality | |
PdfSaveOptions options = new PdfSaveOptions(); | |
options.JpegQuality = 100; | |
// Convert Word to PDF | |
doc.Save("output.pdf", 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
Document doc = new Document("word.docx"); | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Convert 3 pages starting from index 1 where 0 is the first page's index | |
options.PageIndex = 1; | |
options.PageCount = 3; | |
// Save Word as PDF | |
doc.Save("output.pdf", 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
Document doc = new Document("word.docx"); | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Text and image compression | |
options.TextCompression = PdfTextCompression.Flate; | |
options.ImageCompression = PdfImageCompression.Auto; | |
// Save Word as PDF | |
doc.Save("output.pdf", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment