Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active February 12, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/d80998365f9fbb69f99b04f642b6caa6 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/d80998365f9fbb69f99b04f642b6caa6 to your computer and use it in GitHub Desktop.
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