PdfOptions
Contents
[
Hide
]PdfOptions class
Provides options that control how a presentation is saved in Pdf format.
public class PdfOptions : SaveOptions, IPdfOptions
Constructors
Name | Description |
---|---|
PdfOptions() | Default constructor. |
Properties
Name | Description |
---|---|
AccessPermissions { get; set; } | Contains a set of flags specifying which access permissions should be granted when the document is opened with user access. See PdfAccessPermissions . |
AdditionalCommonFontFamilies { get; set; } | Returns or sets an array of user-defined names of font families which Aspose.Slides should consider common. Read/write String[]. |
ApplyImageTransparent { get; set; } | Applies the specified transparent color to an image if true . |
BestImagesCompressionRatio { get; set; } | Indicates if the most effective compression (instead of the default one) for each image must be selected automatically. If set to Boolean.true, for every image in presentation the most appropriate compression algorithm will be chosen, what will lead to the smaller size of the resulting PDF document. Best image compression ratio selection is computationally expensive and takes an additional amount of RAM, and this option is Boolean.false by default. |
Compliance { get; set; } | Desired conformance level for generated PDF document. Read/write PdfCompliance . |
DefaultRegularFont { get; set; } | Returns or sets font used in case source font is not found. Read-write String. |
DrawSlidesFrame { get; set; } | True to draw black frame around each slide. Read/write Boolean. |
EmbedFullFonts { get; set; } | Determines if all characters of font should be embedded or only used subset. Read/write Boolean. |
EmbedTrueTypeFontsForASCII { get; set; } | Determines if Aspose.Slides will embed common fonts for ASCII (33..127 code range) text. Fonts for character codes greater than 127 are always embedded. Common fonts list includes PDF’s base 14 fonts and additional user specified fonts. Read/write Boolean. |
ImageTransparentColor { get; set; } | Gets or sets the image transparent color. |
JpegQuality { get; set; } | Returns or sets a value determining the quality of the JPEG images inside PDF document. Read/write Byte. |
NotesCommentsLayouting { get; } | Provides options that control how notes and comments is placed in exported document. |
Password { get; set; } | Setting user password to protect the PDF document. Read/write String. |
ProgressCallback { get; set; } | Represents a callback object for saving progress updates in percentage. See IProgressCallback . |
SaveMetafilesAsPng { get; set; } | True to convert all metafiles used in a presentation to the PNG images. Read/write Boolean. |
ShowHiddenSlides { get; set; } | Specifies whether the generated document should include hidden slides or not. Default is false . |
SufficientResolution { get; set; } | Returns or sets a value determining resolution of images inside PDF document. |
TextCompression { get; set; } | Specifies compression type to be used for all textual content in the document. Read/write PdfTextCompression . |
WarningCallback { get; set; } | Returns of sets an object which receives warnings and decides whether loading process will continue or will be aborted. Read/write IWarningCallback . |
Examples
The following example shows how to convert PowerPoint to PDF with custom options.
[C#]
using (Presentation presentation = new Presentation("PowerPoint.pptx"))
{
// Instantiates the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Sets the Jpeg quality
pdfOptions.JpegQuality = 90;
// Sets the behavior for metafiles
pdfOptions.SaveMetafilesAsPng = true;
// Sets the text compression level
pdfOptions.TextCompression = PdfTextCompression.Flate;
// Defines the PDF standard
pdfOptions.Compliance = PdfCompliance.Pdf15;
// Saves the presentation as a PDF
presentation.Save("PowerPoint-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
}
The following example shows how to convert PowerPoint to PDF with hidden slides.
[C#]
// Instantiates a Presentation class that represents a PowerPoint file
using (Presentation presentation = new Presentation("PowerPoint.pptx"))
{
// Instantiates the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Adds hidden slides
pdfOptions.ShowHiddenSlides = true;
// Saves the presentation as a PDF
presentation.Save("PowerPoint-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
}
The following example shows how to convert PowerPoint to password protected PDF.
[C#]
// Instantiates a Presentation object that represents a PowerPoint file
using (Presentation presentation = new Presentation("PowerPoint.pptx"))
{
/// Instantiates the PdfOptions class
PdfOptions pdfOptions = new PdfOptions();
// Sets PDF password and access permissions
pdfOptions.Password = "password";
pdfOptions.AccessPermissions = PdfAccessPermissions.PrintDocument | PdfAccessPermissions.HighQualityPrint;
// Saves the presentation as a PDF
presentation.Save("PPTX-to-PDF.pdf", SaveFormat.Pdf, pdfOptions);
}
The following example shows how to convert PowerPoint to PDF with notes.
[C#]
// Instantiate a Presentation object that represents a presentation file
using (Presentation presentation = new Presentation("SelectedSlides.pptx"))
{
using (Presentation auxPresentation = new Presentation())
{
ISlide slide = presentation.Slides[0];
auxPresentation.Slides.InsertClone(0, slide);
// Setting Slide Type and Size
//auxPresentation.SlideSize.SetSize(presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height,SlideSizeScaleType.EnsureFit);
auxPresentation.SlideSize.SetSize(612F, 792F, SlideSizeScaleType.EnsureFit);
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.NotesCommentsLayouting.NotesPosition = NotesPositions.BottomFull;
auxPresentation.Save("PDFnotes_out.pdf", SaveFormat.Pdf, pdfOptions);
}
}
See Also
- class SaveOptions
- interface IPdfOptions
- namespace Aspose.Slides.Export
- assembly Aspose.Slides