PdfSaveOptionsJpegQuality Property
Gets or sets a value determining the quality of the JPEG images inside PDF document.

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 20.1
public int JpegQuality { get; set; }

Property Value

Type: Int32

The default value is 100.

This property is used in conjunction with the ImageCompression option.

Has effect only when a document contains JPEG images.

Use this property to get or set the quality of the images inside a document when saving in PDF format. The value may vary from 0 to 100 where 0 means worst quality but maximum compression and 100 means best quality but minimum compression. If quality is 100 and source image is JPEG, it means no compression - original bytes will be saved.

Shows how to save images to PDF using JPEG encoding to decrease file size.
Document doc = new Document(MyDir + "SaveOptions.PdfImageCompression.rtf");

PdfSaveOptions options = new PdfSaveOptions
    ImageCompression = PdfImageCompression.Jpeg,
    PreserveFormFields = true
doc.Save(ArtifactsDir + "SaveOptions.PdfImageCompression.pdf", options);

PdfSaveOptions optionsA1B = new PdfSaveOptions
    Compliance = PdfCompliance.PdfA1b,
    ImageCompression = PdfImageCompression.Jpeg,
    JpegQuality = 100, // Use JPEG compression at 50% quality to reduce file size
    ImageColorSpaceExportMode = PdfImageColorSpaceExportMode.SimpleCmyk

doc.Save(ArtifactsDir + "SaveOptions.PdfImageComppression PDF_A_1_B.pdf", optionsA1B);
See Also