Load Presentation document with options

GroupDocs.Conversion provides the PresentationLoadOptions class to give you better control over how the source presentation document will be processed. The following options could be set:

  • setFormat allows you to specify explicitly the type of the source presentation document. Available options are: Ppt, Pps, Pptx, Ppsx, Odp, Otp, Potx, Pot, Potm, Pptm, Ppsm.
  • setDefaultFont sets a default font for rendering the presentation. The following font will be used if a presentation font is missing.
  • setFontSubstitutes sets substitute specific fonts from the source presentation document.
  • setPassword specifies a password to unlock the protected document.
  • setHideComments specifies that comments from source presentation must be hidden during conversion.
  • setShowHiddenSlides specifies that hidden slides should be included in the converted document.

Hide comments

The following code snippet shows how to convert a presentation and hide comments:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.PresentationLoadOptions;
...
PresentationLoadOptions loadOptions = new PresentationLoadOptions();
loadOptions.setHideComments(true);

Converter converter = new Converter("sample.pptx", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

Specify font substitutions

The following code snippet shows how to convert a presentation and specify font substitutions for missing fonts:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.contracts.FontSubstitute;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.PresentationLoadOptions;
import java.util.ArrayList;
import java.util.List;
...
PresentationLoadOptions loadOptions = new PresentationLoadOptions();

List<FontSubstitute> fontSubstitutes = new ArrayList<FontSubstitute>();
fontSubstitutes.add(FontSubstitute.create("Tahoma", "Arial"));
fontSubstitutes.add(FontSubstitute.create("Times New Roman", "Arial"));
loadOptions.setDefaultFont("Helvetica");
loadOptions.setFontSubstitutes(fontSubstitutes);

Converter converter = new Converter("sample.pptx", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

Include hidden slides

The following code snippet shows how to convert a presentation including the hidden slides:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.PresentationLoadOptions;
...
PresentationLoadOptions loadOptions = new PresentationLoadOptions();
loadOptions.setShowHiddenSlides(true);

Converter converter = new Converter("sample.pptx", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);