Convert PowerPoint to PDF using Syncfusion® .NET PowerPoint library
28 Jul 202624 minutes to read
The Syncfusion .NET PowerPoint Library (Presentation) allows you to convert a PowerPoint presentation to PDF within a few lines of code in .NET applications. It does not require Adobe Acrobat or Microsoft PowerPoint to be installed on the machine. You can create an input PowerPoint presentation from scratch, or load an existing PowerPoint presentation and then convert it to PDF.
The Syncfusion® PowerPoint to PDF converter offers high versatility and seamless performance across various .NET platforms, including Windows Forms, WPF, ASP.NET, ASP.NET MVC, ASP.NET Core, Blazor, Xamarin, WinUI, .NET MAUI. Also, in different environments like Azure, AWS, Google Cloud, Linux, and macOS.
Key Features
- Ability to convert an entire PowerPoint Presentation to PDF.
- Specify the number of slides per PDF page with the Handouts option.
- Convert slides with notes pages to PDF.
- Embed fonts in a PowerPoint file into the converted PDF document to avoid font-related issues across different machines and different platforms.
- Convert a PowerPoint document to PDF with the PDF-A1B conformance standards.
- Specify fallback fonts to be used in place of missing fonts.
- Skip or include hidden slides.
- Set the quality of images in the PowerPoint slides to reduce the converted PDF document size.
Assemblies and NuGet packages required
Refer to the following links for the assemblies required for each platform to convert a PowerPoint document to PDF.
To quickly start converting a PowerPoint Presentation to a PDF using the .NET PowerPoint library, check out this video:
Convert PowerPoint to PDF
The following namespaces are required to compile the code:
using Syncfusion.Pdf;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;using Syncfusion.OfficeChartToImageConverter;
using Syncfusion.Presentation;
using Syncfusion.PresentationToPdfConverter;
using Syncfusion.Pdf;Imports Syncfusion.OfficeChartToImageConverter
Imports Syncfusion.Presentation
Imports Syncfusion.PresentationToPdfConverter
Imports Syncfusion.PdfThe following code example illustrates how to convert a PowerPoint document into PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Template.pptx"))
{
//Convert the PowerPoint presentation into a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the PDF document.
pdfDocument.Save("Result.pdf");
}
}//Opens a PowerPoint Presentation
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Creates an instance of ChartToImageConverter and assigns it to ChartToImageConverter property of Presentation
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
//Converts the PowerPoint Presentation into PDF document
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc);
//Saves the PDF document
pdfDocument.Save("Sample.pdf");
//Closes the PDF document
pdfDocument.Close(true);
//Closes the Presentation
pptxDoc.Close();'Opens a PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Creates an instance of ChartToImageConverter and assigns it to ChartToImageConverter property of Presentation
pptxDoc.ChartToImageConverter = New ChartToImageConverter()
'Converts the PowerPoint Presentation into PDF document
Dim pdfDocument As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc)
'Saves the PDF document
pdfDocument.Save("Sample.pdf")
'Closes the PDF document
pdfDocument.Close(True)
'Closes the Presentation
pptxDoc.Close()You can download a complete working sample from GitHub.
NOTE
- Creating an instance of the ChartToImageConverter class is mandatory to convert the charts in the presentation. Otherwise, the charts are not exported to the converted PDF.
- The assembly “Syncfusion.SfChart.WPF” is non-compliant with the FIPS (Federal Information Processing Standard) algorithm policy.
PowerPoint Presentation to PDF conversion in Linux OS
In Linux OS, you can perform the PowerPoint presentation to PDF conversion using a .NET Core (Targeting netcoreapp) application. For further information, click here.
Font substitution
When a font used in a PowerPoint presentation is unavailable in the environment where the document is converted to PDF, the library substitutes Microsoft Sans Serif as the default font for text rendering. This leads to differences in the text layouts between the PowerPoint presentation and the converted PDF document. To avoid this, the Syncfusion® Presentation library allows you to set an alternate font for any missing font used in the PowerPoint presentation. For further information, click here.
Fallback fonts
During PowerPoint to PDF conversions, if a glyph of the input text is unavailable in the specified font, the text will not be rendered properly. To address this, the Syncfusion® PowerPoint (Presentation) library allows users to specify fallback fonts. When a glyph is missing, the library uses one of the fallback fonts to render the text correctly in the output PDF document. For further information, click here.
Show Warning for unsupported elements
The Presentation library shows a warning message about unsupported elements such as Metafile images and charts (supported from .NET Standard 2.0) that are present in the input PowerPoint presentation during the PowerPoint to PDF conversion. It also allows you to cancel or continue the PowerPoint to PDF conversion when an unsupported element is present.
The following code example demonstrates how to cancel or continue the PowerPoint presentation to PDF conversion when an unsupported element (Metafile or Chart) is present in the input PowerPoint presentation.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Template.pptx"))
{
//Instantiate PresentationToPdfConverterSettings.
PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings();
//Subscribe to the warnings collection.
settings.Warning = new DocumentWarning();
//Convert the PowerPoint presentation into a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, settings))
{
//If the PowerPoint to PDF conversion has been stopped, IsCanceled is true; otherwise it is false.
if (!PresentationToPdfConverter.IsCanceled)
{
//Save the PDF file.
pdfDocument.Save("Output.pdf");
}
else
{
Console.WriteLine("PowerPoint to PDF conversion is stopped. Press any key to exit the application.");
Console.ReadKey();
}
}
}
/// <summary>
/// DocumentWarning class implements the IWarning interface
/// </summary>
/// <seealso cref="IWarning" />
public class DocumentWarning : IWarning
{
/// <summary>
/// Gets the Boolean value indicating whether to continue the conversion.
/// </summary>
/// <param name="warningInfo">Collection of warnings</param>
/// <returns>True to continue the conversion; otherwise, false.</returns>
public bool ShowWarnings(List<WarningInfo> warningInfo)
{
//By default, continue the PowerPoint to PDF conversion by setting isContinueConversion to true.
bool isContinueConversion = true;
foreach (WarningInfo warning in warningInfo)
{
//Mark the conversion as interrupted when warnings are present; the loop below can override this.
isContinueConversion = false;
//Print the description of the warning.
Console.WriteLine(warning.Description);
if (warning.Description.Contains("Metafile") || warning.Description.Contains("Chart"))
{
Console.WriteLine("Type [Y] if you want to continue the Presentation to PDF conversion, or [N] to cancel the conversion.");
String confirmation = Console.ReadLine();
//Based on the WarningType enumeration, you can perform custom logic here.
//Continue the PowerPoint to PDF conversion when the user enters Y; otherwise, cancel it.
if (confirmation.ToLower().Equals("y"))
isContinueConversion = true;
else
isContinueConversion = false;
}
}
return isContinueConversion;
}
}//Essential Presentation library supports the Show warning for unsupported elements feature in C# [Cross-platform], Blazor Server, and Xamarin applications.'Essential Presentation library supports the Show warning for unsupported elements feature in VB.NET [Cross-platform], Blazor Server, and Xamarin applications.You can download a complete working sample from GitHub.
Handouts
The Presentation library allows you to convert a PowerPoint presentation to PDF document with the Handouts option. This allows you to select the number of slides to include per PDF page, which lets you render multiple PowerPoint slides on a single PDF page.
The following code sample demonstrates how to convert a PowerPoint presentation to PDF document with the Handouts property.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Enable the handouts and number of pages per slide options in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.PublishOptions = PublishOptions.Handouts;
pdfConverterSettings.SlidesPerPage = SlidesPerPage.Nine;
//Convert the PowerPoint presentation to a PDF document by passing the PDF conversion settings as parameter.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Enable the handouts and number of pages per slide options in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.PublishOptions = PublishOptions.Handouts;
pdfConverterSettings.SlidesPerPage = SlidesPerPage.Nine;
//Convert the documents by passing the PDF conversion settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
//Save the converted PDF document.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable the handouts and number of pages per slide options in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = new PresentationToPdfConverterSettings()
pdfConverterSettings.PublishOptions = PublishOptions.Handouts
pdfConverterSettings.SlidesPerPage = SlidesPerPage.Nine
'Convert the documents by passing the PDF conversion settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF document.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Notes pages
The Presentation library allows you to convert a PowerPoint presentation to PDF document with the notes pages option, which includes the notes content during the PDF conversion.
The following code sample demonstrates how to convert a PowerPoint presentation to PDF with notes pages.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Enable the notes pages option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.PublishOptions = PublishOptions.NotesPages;
//Convert the PowerPoint presentation to a PDF document by passing the PDF conversion settings as parameter.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Enable the include hidden slides option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.PublishOptions = PublishOptions.NotesPages;
//Convert the documents by passing the settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
//Save the converted PDF file.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable the include hidden slides option in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings()
pdfConverterSettings.PublishOptions = PublishOptions.NotesPages
'Convert the documents by passing the settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF file.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Include hidden slides
The PowerPoint presentation supports hiding slides in a presentation document. Hidden slides are not included in the converted PDF document by default. The Presentation library allows you to include or exclude hidden slides while converting a PowerPoint presentation to PDF document.
The following code sample demonstrates how to include hidden slides while converting a PowerPoint presentation to PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Enable the include hidden slides option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.ShowHiddenSlides = true;
//Convert the PowerPoint presentation to a PDF document by passing the PDF conversion settings as parameter.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Enable or disable including the hidden slides option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
pdfConverterSettings.ShowHiddenSlides = true;
//Convert the documents by passing the settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
//Save the converted PDF file.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable or disable including the hidden slides option in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = new PresentationToPdfConverterSettings()
pdfConverterSettings.ShowHiddenSlides = true
'Convert the documents by passing the settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF file.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Recreate Nested Metafile
This setting allows you to regenerate the nested EMF images in the PowerPoint presentation document during PDF conversion. This property is recommended to resolve the scaling problem of the nested metafile images by regenerating the nested metafile images present in the PowerPoint presentation document.
The following code sample shows how to use this property to regenerate the nested EMF images in the PowerPoint presentation document during PDF conversion.
//The Essential Presentation Library supports to Recreate Nested Metafile in Windows forms, WPF, ASP.NET and ASP.NET MVC platform alone, and it's also supported in .NET Core 3.0, but it requires PresentationToPDFConverter assembly instead of PresentationRenderer.//Open a PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Create an instance of the ChartToImageConverter and assign it to the ChartToImageConverter property of the Presentation.
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
//Initialize the conversion settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the RecreateNestedMetafile property to true to recreate the nested metafile automatically.
pdfConverterSettings.RecreateNestedMetafile = true;
//Convert the PowerPoint Presentation into a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save a PDF document.
pdfDocument.Save("Sample.pdf");
}
}'Open a PowerPoint Presentation.
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Create an instance of the ChartToImageConverter and assign it to the ChartToImageConverter property of the Presentation.
pptxDoc.ChartToImageConverter = New ChartToImageConverter()
'Initialize the conversion settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = New PresentationToPdfConverterSettings()
'Set the RecreateNestedMetafile property to true to recreate the nested metafile automatically.
pdfConverterSettings.RecreateNestedMetafile = True
'Convert the PowerPoint Presentation into a PDF document.
Using pdfDocument As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save a PDF document.
pdfDocument.Save("Sample.pdf")
End Using
End UsingYou can download a complete working sample from GitHub.
PDF Conformance
The Syncfusion® Presentation library currently supports the following PDF conformance levels while converting a PowerPoint document to PDF:
- PDF/A-1b conformance
- PDF/X-1a conformance
NOTE
- To know more details about PDF/A standard refer https://en.wikipedia.org/wiki/PDF/A#Description
- To know more details about PDF/X standard refer https://en.wikipedia.org/wiki/PDF/X
The following code sample demonstrates how to set the PDF conformance level while PowerPoint presentation to PDF conversion.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Initialize the conversion settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the PDF conformance level to A1B.
pdfConverterSettings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
//Convert the PowerPoint presentation to a PDF document.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint document
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Initialize the conversion settings
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the Pdf conformance level to A1B
pdfConverterSettings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
//Convert the PowerPoint document to PDF
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc,pdfConverterSettings);
//Save the converted PDF file.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable or disable including the hidden slides option in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = new PresentationToPdfConverterSettings()
'Set the Pdf conformance level to A1B
pdfConverterSettings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B
'Convert the documents by passing the settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF file.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Accessible PDF document
This setting allows you to determine whether to preserve structured document tags in the converted PDF document for accessibility (508 or PDF/UA compliance) support. This property will set the title and description for images, diagrams, and other objects in the generated PDF document. This information will be helpful for people with vision or cognitive impairments who may not be able to see or understand the object.
The following code sample shows how to preserve structured document tags in the converted PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Instantiate PresentationToPdfConverterSettings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Enable a flag to preserve structured document tags in the converted PDF document.
pdfConverterSettings.AutoTag = true;
//Convert the PowerPoint presentation to a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDocument.Save("Sample.pdf");
}
}//Open a PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Create an instance of the ChartToImageConverter and assign it to the ChartToImageConverter property of the Presentation.
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
//Initialize the conversion settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Enable a flag to preserve structured document tags in the converted PDF document.
pdfConverterSettings.AutoTag = true;
//Convert the PowerPoint Presentation into a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save a PDF document.
pdfDocument.Save("Sample.pdf");
}
}'Open a PowerPoint Presentation.
Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Create an instance of the ChartToImageConverter and assign it to the ChartToImageConverter property of the Presentation.
pptxDoc.ChartToImageConverter = New ChartToImageConverter()
'Initialize the conversion settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = New PresentationToPdfConverterSettings()
'Enable a flag to preserve structured document tags in the converted PDF document.
pdfConverterSettings.AutoTag = True
'Convert the PowerPoint Presentation into a PDF document.
Using pdfDocument As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save a PDF document.
pdfDocument.Save("Sample.pdf")
End Using
End UsingYou can download a complete working sample from GitHub.
PowerPoint shapes to PDF form field
This setting allows you to preserve PowerPoint shapes as PDF form fields in the converted PDF document. Shapes with names starting with FormField_ are converted into editable text form fields in the resulting PDF. This feature helps you create interactive and fillable PDF forms from PowerPoint presentations.
The following code sample shows how to preserve PowerPoint form fields as PDF form fields in the converted PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Template.pptx"))
{
//Instantiate PresentationToPdfConverterSettings.
PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings();
//Enable a flag to preserve form fields by converting shapes with names starting with 'FormField_' into editable text form fields in the PDF.
settings.PreserveFormFields = true;
//Convert the PowerPoint presentation to a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the PDF document to the file system.
pdfDocument.Save("PPTXToPDF.pdf");
}
}//Open a PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open("Template.pptx"))
{
// Create new instance for PresentationToPdfConverterSettings
PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings();
//Enables a flag to preserve form fields by converting shapes with names starting with 'FormField_' into editable text form fields in the PDF.
settings.PreserveFormFields = true;
//Convert the PowerPoint Presentation into a PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, settings))
{
//Save a PDF document.
pdfDocument.Save("Result.pdf");
}
}'Open a PowerPoint Presentation.
Using pptxDoc As IPresentation = Presentation.Open("Template.pptx")
'Create new instance for PresentationToPdfConverterSettings
Dim settings As New PresentationToPdfConverterSettings()
'Enables a flag to preserve form fields by converting shapes with names starting with 'FormField_' into editable text form fields in the PDF.
settings.PreserveFormFields = True
'Convert the PowerPoint Presentation into a PDF document.
Using pdfDocument As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, settings)
'Save a PDF document.
pdfDocument.Save("Result.pdf")
End Using
End UsingBy running the above code, you will generate a PDF with editable text form fields as shown below.

You can download a complete working sample from GitHub.
Chart quality
The Presentation library provides an option to decide the quality of the charts to optimize the converted PDF document size.
NOTE
- The default ScalingMode for charts is ScalingMode.Normal.
- Setting the Best scaling mode will improve the quality of the converted charts and increase the converted PDF document size.
The following code sample demonstrates how to set the quality of the charts while PowerPoint presentation to PDF conversion.
// Creating an instance of the ChartToImageConverter class is not necessary in C# [Cross-platform],
// as it is initialized internally in the Syncfusion.PresentationRenderer.Portable assembly.//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Create an instance of ChartToImageConverter and assigns it to ChartToImageConverter property of Presentation
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
//Sets the scaling mode of the chart to best.
pptxDoc.ChartToImageConverter.ScalingMode = ScalingMode.Best;
//Convert the documents by passing the PDF conversion settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc);
//Save the converted PDF document.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Create an instance of ChartToImageConverter and assigns it to ChartToImageConverter property of Presentation
pptxDoc.ChartToImageConverter = new ChartToImageConverter()
'Sets the scaling mode of the chart to best.
pptxDoc.ChartToImageConverter.ScalingMode = ScalingMode.Best
'Convert the documents by passing the PDF conversion settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc)
'Save the converted PDF document.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Optimizing the converted PDF document size
Optimizing the identical images
The presentation library allows you to optimize the memory usage for the duplicate images while converting the PowerPoint presentation to PDF document to reduce the document size.
The following code sample demonstrates how to optimize the duplicate images while converting a PowerPoint presentation to PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Initialize the conversion settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the flag to optimize the identical images.
pdfConverterSettings.OptimizeIdenticalImages = true;
//Convert the PowerPoint presentation to a PDF document.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Enable the include hidden slides option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the flag to optimize the identical images
pdfConverterSettings.OptimizeIdenticalImages = true;
//Convert the documents by passing the settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
//Save the converted PDF file.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable the include hidden slides option in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = new PresentationToPdfConverterSettings()
'Set the flag to optimize the identical images
pdfConverterSettings.OptimizeIdenticalImages = true
'Convert the documents by passing the settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF file.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Optimizing the image quality and resolution
You may have high resolution images in the PowerPoint slides which will impact the size of the converted PDF document. The Presentation library allows you to optimize the document size, by adjusting the quality and resolution of the images while converting the PowerPoint presentation to PDF document.
The following code sample demonstrates how to optimize the image quality and resolution while converting a PowerPoint presentation to PDF document.
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open("Sample.pptx"))
{
//Initialize the conversion settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the image resolution.
pdfConverterSettings.ImageResolution = 100;
//Set the image quality.
pdfConverterSettings.ImageQuality = 100;
//Convert the PowerPoint presentation to a PDF document.
using (PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings))
{
//Save the PDF document to the file system.
pdfDoc.Save("Sample.pdf");
}
}//Load the PowerPoint presentation to convert.
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
//Enable the include hidden slides option in converter settings.
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
//Set the image resolution
pdfConverterSettings.ImageResolution = 100;
//Set the image quality
pdfConverterSettings.ImageQuality = 100;
//Convert the documents by passing the settings as parameter.
PdfDocument pdfDoc = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
//Save the converted PDF file.
pdfDoc.Save("Sample.pdf");
//Close the presentation instance
pptxDoc.Close();
//Close the PDF instance
pdfDoc.Close();'Load the PowerPoint presentation to convert.
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
'Enable the include hidden slides option in converter settings.
Dim pdfConverterSettings As PresentationToPdfConverterSettings = new PresentationToPdfConverterSettings()
'Set the image resolution
pdfConverterSettings.ImageResolution = 100
'Set the image quality
pdfConverterSettings.ImageQuality = 100
'Convert the documents by passing the settings as parameter.
Dim pdfDoc As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings)
'Save the converted PDF file.
pdfDoc.Save("Sample.pdf")
'Close the presentation instance
pptxDoc.Close()
'Close the PDF instance
pdfDoc.Close()You can download a complete working sample from GitHub.
Online Demo
- Explore how to convert a PowerPoint presentation to PDF using the .NET PowerPoint Library (Presentation) in a live demo here.
- See how to convert a PowerPoint presentation to PDF/UA using the .NET PowerPoint Library (Presentation) in a live demo here.
- See how to convert a PowerPoint presentation to PDF/A using the .NET PowerPoint Library (Presentation) in a live demo here.