Converting Presentation to PDF

Converting Presentation to PDF

Aspose.Slides for Java offers the Presentation class that represents a presentation file. The Presentation class exposes the Save method that can be called to convert the whole presentation into a PDF document. The PdfOptions class provides options for creating the PDF such as setJpegQuality, setTextCompression, setCompliance and others. These options can be used to get the desired standard of PDF.

Using the Default Options

The following example shows how to convert a presentation into a PDF document using the default options. The default options create a PDF document of maximum quality.

Using Custom Options

The following example shows how to convert a presentation into a PDF document with customized options as provided by the PdfOptions class. It sets the JPEG quality, saves metafiles to PNG, sets text compression level and PDF standard. You can also include comments in generated PDF by using PdfOptions** **class and INotesCommentsLayoutingOptions interface.

Including Hidden Slides

The following example shows how to convert a presentation into a PDF document with hidden slides included as provided by the PdfOptions class. It sets the setShowHiddenSlides(boolean) method to generate PDF with hidden slides.

Method setShowHiddenSlides(boolean) has been added to IHtmlOptions, IPdfOptions, ISwfOptions, ITiffOptions, IXpsOptions interfaces and HtmlOptions, PdfOptions, SwfOptions, TiffOptions, XpsOptions classes.

This method specifies whether the exported document should include hidden slides or not. The default value is false.

Password Protected PDF

The following example shows how to convert a presentation to a password protected PDF document with customized options as provided by the PdfOptions class.

Converting a Specific Slide to PDF

The following example shows how to convert a specific slide in a presentation to a PDF document with custom options.

Save to PDF notes with custom slide size

The following example shows how to convert a presentation to a PDF notes document with custom slide size. Where each inch equals 72 pixels.

Set PDF Access Permissions

You can set access permissions to a PDF document using Aspose.Slides for Java. For this purpose, setAccessPermissions() method has been added to a PdfOptions** **class. The possible values which allow you to restrict access rights to a PDF document are defined in the PdfAccessPermissions class.

The following code demonstrates how you can set access permissions to a PDF document only for printing.