Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Word to PDF Conversions in C# | Aspose.Words for .NET
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);
// Load the document from disk.
Document doc = new Document("word.doc");
// Save as PDF
doc.Save("output.pdf");
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);
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);
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);
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
You can’t perform that action at this time.