Skip to content

Instantly share code, notes, and snippets.

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/bcc4f993d6b75479636e621002468f35 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/bcc4f993d6b75479636e621002468f35 to your computer and use it in GitHub Desktop.
Aspose.Slide for Java - PowerPoint to PDF Conversion Blog
// Instantiate a Presentation object that represents a presentation file
Presentation pres = new Presentation("demo.pptx");
// Instantiate the PdfOptions class
PdfOptions opts = new PdfOptions();
// Setting PDF password
opts.setPassword("password");
// Save the presentation to password protected PDF
pres.save("output.pdf", SaveFormat.Pdf, opts);
// Create PDF options
PdfOptions pdfOptions = new PdfOptions();
// Set password
pdfOptions.setPassword("my_password");
// Set access permissions
pdfOptions.setAccessPermissions(PdfAccessPermissions.PrintDocument| PdfAccessPermissions.HighQualityPrint);
// Load PowerPoint presentation
Presentation presentation = new Presentation("Presentation.pptx");
try {
presentation.save("output.pdf", SaveFormat.Pdf, pdfOptions);
} finally {
if (presentation != null) presentation.dispose();
}
// Instantiate a Presentation object that represents a presentation file
Presentation pres = new Presentation("presentation.pptx");
// Instantiate the PdfOptions class
PdfOptions opts = new PdfOptions();
// Set JPEG Quality
opts.setJpegQuality((byte) 90);
// Define behavior for Metafiles
opts.setSaveMetafilesAsPng(true);
// Set Text Compression level
opts.setTextCompression(PdfTextCompression.Flate);
// Define the PDF standard
opts.setCompliance(PdfCompliance.Pdf15);
INotesCommentsLayoutingOptions options = opts.getNotesCommentsLayouting();
options.setNotesPosition(NotesPositions.BottomFull);
// Save the presentation to PDF with specified options
pres.save("output.pdf", SaveFormat.Pdf, opts);
Presentation pres = new Presentation("presentation.pptx");
try {
// Instantiate the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Specify that the generated document should include hidden slides
pdfOptions.setShowHiddenSlides(true);
// Save the presentation to PDF with specified options
pres.save("output.pdf", SaveFormat.Pdf, pdfOptions);
} finally {
if (pres != null)
pres.dispose();
}
// Instantiate a Presentation object that represents a presentation file
Presentation pres = new Presentation("presentation.pptx");
// Save the presentation to PDF with default options
pres.save("output.pdf", SaveFormat.Pdf);
// Instantiate a Presentation object that represents a presentation file
Presentation pres = new Presentation("presentation.pptx");
// Setting array of slides positions
int[] slides = new int[] { 2, 3, 5 };
// Save the presentation to PDF
pres.save("output.pdf", slides, SaveFormat.Pdf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment