Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert PowerPoint to PDF in C# - Aspose.Slides
// Instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PowerPoint.pptx");
/// Instantiate the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Setting PDF password and access permissions
pdfOptions.Password = "password";
pdfOptions.AccessPermissions = PdfAccessPermissions.PrintDocument | PdfAccessPermissions.HighQualityPrint;
// Save the presentation as PDF
presentation.Save("PPTX-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
// Instantiate a Presentation object that represents a PPT file
Presentation presentation = new Presentation("PowerPoint.ppt");
// Save the presentation as PDF
presentation.Save("PPT-to-PDF.pdf", SaveFormat.Pdf);
// Instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PowerPoint.pptx");
// Instantiate the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Set Jpeg quality
pdfOptions.JpegQuality = 90;
// Set behavior for metafiles
pdfOptions.SaveMetafilesAsPng = true;
// Set text compression level
pdfOptions.TextCompression = PdfTextCompression.Flate;
// Define the PDF standard
pdfOptions.Compliance = PdfCompliance.Pdf15;
// Save the presentation as PDF
presentation.Save("PowerPoint-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
// Instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PowerPoint.pptx");
// Instantiate the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Include hidden slides
pdfOptions.ShowHiddenSlides = true;
// Save the presentation as PDF
presentation.Save("PowerPoint-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
// Instantiate a Presentation object that represents a PPTX file
Presentation presentation = new Presentation("PowerPoint.pptx");
// Setting array of slides positions
int[] slides = { 1, 3 };
// Save the presentation as PDF
presentation.Save("PPTX-to-PDF.pdf", slides, SaveFormat.Pdf);
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.