Load Presentation document with options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion provides PresentationLoadOptions to give you 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:

const loadOptions = new groupdocs.conversion.PresentationLoadOptions()
loadOptions.setHideComments(true)

const outputPath = "ConvertPresentationByHidingComments.pdf"

const converter = new groupdocs.conversion.Converter("sample.pptx", loadOptions)
const convertOptions = new groupdocs.conversion.PdfConvertOptions()

console.log(`Pdf document converted successfully to ${outputPath} (by hiding comments)`)
converter.convert(outputPath, convertOptions)

Specify font substitutions

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

const java = require('java') 

const outputPath = "ConvertPresentationBySpecifyingFontSubstitution.pdf";

const fontSubstitutes = java.newInstanceSync("java.util.ArrayList");
fontSubstitutes.add(groupdocs.conversion.FontSubstitute.create("Tahoma", "Arial"));
fontSubstitutes.add(groupdocs.conversion.FontSubstitute.create("Times New Roman", "Arial"));

const loadOptions = new groupdocs.conversion.PresentationLoadOptions()
loadOptions.setDefaultFont("Helvetica.ttf");
loadOptions.setFontSubstitutes(fontSubstitutes);

const converter = new groupdocs.conversion.Converter("sample.pptx", loadOptions);
const convertOptions = new groupdocs.conversion.PdfConvertOptions();

console.log(`Pdf document converted successfully to ${outputPath} (by specifying font subs)`);
converter.convert(outputPath, convertOptions);

Include hidden slides

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

const loadOptions = new groupdocs.conversion.PresentationLoadOptions()
loadOptions.setShowHiddenSlides(true)

const outputPath = "ConvertPresentationWithHiddenSlidesIncluded.pdf"

const converter = new groupdocs.conversion.Converter("sample.pptx", loadOptions)
const convertOptions = new groupdocs.conversion.PdfConvertOptions()

console.log(`Pdf document converted successfully to ${outputPath} (with hidden slides included)`)
converter.convert(outputPath, convertOptions)