WPF

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfCompressionOptions - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfCompressionOptions

    Represents compression options of the loaded document.

    Inheritance
    System.Object
    PdfCompressionOptions
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    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 compress images based on the image quality.

    Declaration
    public bool CompressImages { get; set; }
    Property Value
    Type Description
    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;
    //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)

    ImageQuality

    Gets or sets the image quality.

    Declaration
    public int ImageQuality { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    Default value is 50.

    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)

    OptimizeFont

    Gets or sets whether to optimize font data.

    Declaration
    public bool OptimizeFont { get; set; }
    Property Value
    Type Description
    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;
    //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)

    OptimizePageContents

    Gets or sets whether to optimize page contents.

    Declaration
    public bool OptimizePageContents { get; set; }
    Property Value
    Type Description
    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;
    //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)

    RemoveMetadata

    Gets or sets whether remove metadata informations.

    Declaration
    public bool RemoveMetadata { get; set; }
    Property Value
    Type Description
    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;
    //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)
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved