Power Point File to PDF Conversion
DynamicPDF converter supports converting Power Point files to PDFs. The following two examples illustrate converting a Power Point to PDF using the static Convert method followed by a more advance example of converting a Power Point to PDF.
PowerPointConverter
Use the PowerPointConverter class to convert Power Point presentations to PDF. The PowerPointConverter class has properties, methods, and events for conversion.
The PowerPointConverter class supports converting using a file path or using a byte array.
Events include PowerPointConverter.Completed, PowerPointConverter.ProgressChanged.
PowerPointConversionOptions
Use the PowerPointConversionOptions class to set a PowerPointConverter class's properties. Set properties for the PowerPointConverter class using the PowerPointConversionOptions class.
The PowerPointConversionOptions class has the following properties:
- OutputType,
- PdfA, and
- PowerPointSlideRange.
These properties are in addition to the inherited ConversionOptions class's properties.
PPT to PDF with Converter.Convert Static Method
The Converter.Convert static method converts PPT documents to PDF files. The Converter uses the PowerPointConversionOptions object to set advanced options for conversion. The following code demonstrates.
private static void PowerPointDemo(string inPath, string outPath)
{
PowerPointConversionOptions powerPointConversionOptions = new PowerPointConversionOptions(PageSize.A4, PageOrientation.Portrait, 36);
HandoutOutputType handout = PowerPointOutputType.Handout;
handout.HandoutPrintOrder = HandoutPrintOrder.Horizontal;
handout.SlidesPerPage = SlidesPerPage.Six;
handout.FrameSlides = true;
powerPointConversionOptions.OutputType = handout;
powerPointConversionOptions.OutputType.PrintHiddenSlide = true;
OutlineViewOutputType outlineView = PowerPointOutputType.OutlineView;
outlineView.PrintHiddenSlide = false;
powerPointConversionOptions.OutputType = outlineView;
Converter.Convert(inPath, outPath, powerPointConversionOptions);
}
Private Sub PowerPointDemo(ByVal inPath As String, ByVal outPath As String)
Dim PowerPointConversionOptions As PowerPointConversionOptions = New PowerPointConversionOptions(PageSize.A4, PageOrientation.Portrait, 36)
Dim handout As HandoutOutputType = PowerPointOutputType.Handout
handout.HandoutPrintOrder = HandoutPrintOrder.Horizontal
handout.SlidesPerPage = SlidesPerPage.Six
handout.FrameSlides = True
PowerPointConversionOptions.OutputType = handout
PowerPointConversionOptions.OutputType.PrintHiddenSlide = True
Dim outlineView As OutlineViewOutputType = PowerPointOutputType.OutlineView
outlineView.PrintHiddenSlide = False
PowerPointConversionOptions.OutputType = outlineView
Converter.Convert(inPath, outPath, PowerPointConversionOptions)
End Sub
Power Point to PDF with Advanced Options
The following example demonstrates using the PowerPointConverter class along with the PowerPointConversionOptions to set advanced options for converting a PPT.
private static void PowerPointDemo(string inPath, string outPath)
{
PowerPointConversionOptions powerPointConversionOptions = new PowerPointConversionOptions(PageSize.A4, PageOrientation.Portrait, 36);
HandoutOutputType handout = PowerPointOutputType.Handout;
handout.HandoutPrintOrder = HandoutPrintOrder.Horizontal;
handout.SlidesPerPage = SlidesPerPage.Six;
handout.FrameSlides = true;
powerPointConversionOptions.OutputType = handout;
powerPointConversionOptions.OutputType.PrintHiddenSlide = true;
PowerPointConverter powerPointConverter1 = new PowerPointConverter(inPath, powerPointConversionOptions);
powerPointConverter1.Convert(outPath);
}
Private Sub PowerPointDemo(ByVal inPath As String, ByVal outPath As String)
Dim PowerPointConversionOptions As PowerPointConversionOptions = New PowerPointConversionOptions(PageSize.A4, PageOrientation.Portrait, 36)
Dim handout As HandoutOutputType = PowerPointOutputType.Handout
handout.HandoutPrintOrder = HandoutPrintOrder.Horizontal
handout.SlidesPerPage = SlidesPerPage.Six
handout.FrameSlides = True
PowerPointConversionOptions.OutputType = handout
PowerPointConversionOptions.OutputType.PrintHiddenSlide = True
Dim powerPointConverter1 As PowerPointConverter = New PowerPointConverter(inPath, PowerPointConversionOptions)
powerPointConverter1.Convert(outPath)
End Sub
GitHub Project
Refer to the converter-dotnet-core example project on GitHub for examples using C# and Visual Basic.
C# | Visual Basic | GitHub |
---|---|---|
PptFileConversion.cs | PptFileConversion.vb | https://github.com/DynamicPDF/converter-dotnet-core |