PdfCompressionOptions Class
Represents the compression options of the loaded document.
Inheritance
System.Object
PdfCompressionOptions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfCompressionOptions
Remarks
To know more about refer this link .
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//set the compress images based on the image quality.
options.CompressImages = true;
//set the image quality.
options.ImageQuality = 50;
//set the optimize font.
options.OptimizeFont = true;
//set the optimize page contents.
options.OptimizePageContents = true;
//set the remove metadata informations.
options.RemoveMetadata = true;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'set the compress images based on the image quality.
options.CompressImages = True
'set the image quality.
options.ImageQuality = 50
'set the optimize font.
options.OptimizeFont = True
'set the optimize page contents.
options.OptimizePageContents = True
'set the remove metadata informations.
options.RemoveMetadata = True
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)
Constructors
PdfCompressionOptions()
Declaration
public PdfCompressionOptions()
Properties
CompressImages
Gets or sets whether to compress images based on the image quality.
Declaration
public bool CompressImages { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//set the compress images based on the image quality.
options.CompressImages = true;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'set the compress images based on the image quality.
options.CompressImages = True
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)
ImageQuality
Declaration
public int ImageQuality { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//set the compress images based on the image quality.
options.CompressImages = true;
//set the image quality.
options.ImageQuality = 50;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'set the compress images based on the image quality.
options.CompressImages = True
'set the image quality.
options.ImageQuality = 50
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)
OptimizeFont
Gets or sets whether to optimize font data.
Declaration
public bool OptimizeFont { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//set the optimize font.
options.OptimizeFont = true;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'set the optimize font.
options.OptimizeFont = True
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)
OptimizePageContents
Gets or sets whether to optimize page contents.
Declaration
public bool OptimizePageContents { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//set the optimize page contents.
options.OptimizePageContents = true;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'set the optimize page contents.
options.OptimizePageContents = True
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)
RemoveMetadata
Gets or sets whether to remove metadata information from the PDF document.
Declaration
public bool RemoveMetadata { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Initialize new instance of PdfCompressionOptions class.
PdfCompressionOptions options = new PdfCompressionOptions();
//Remove metadata information from the document.
options.RemoveMetadata = true;
ldoc.CompressionOptions = options;
//Save and close the document.
ldoc.Save("Output.pdf");
ldoc.Close(true);
'Load an existing document.
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Initialize new instance of PdfCompressionOptions class.
Dim options As PdfCompressionOptions = New PdfCompressionOptions()
'Remove metadata information from the document.
options.RemoveMetadata = True
ldoc.CompressionOptions = options
'Save and Close the document.
ldoc.Save("Output.pdf")
ldoc.Close(True)