com.aspose.words

Class PdfImageCompression

  • java.lang.Object
    • com.aspose.words.PdfImageCompression
public class PdfImageCompression 
extends java.lang.Object

Utility class containing constants. Specifies the type of compression applied to images in the PDF file.

Example:

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

PdfSaveOptions options = new PdfSaveOptions();

options.setImageCompression(PdfImageCompression.JPEG);
options.setPreserveFormFields(true);

doc.save(getMyDir() + "\\Artifacts\\SaveOptions.PdfImageCompression.pdf", options);

PdfSaveOptions optionsA1B = new PdfSaveOptions();
optionsA1B.setCompliance(PdfCompliance.PDF_A_1_B);
optionsA1B.setImageCompression(PdfImageCompression.JPEG);
optionsA1B.setJpegQuality(50); // Use JPEG compression at 50% quality to reduce file size.

doc.save(getMyDir() + "\\Artifacts\\SaveOptions.PdfImageComppression PDF_A_1_B.pdf", optionsA1B);

Field Summary
static final intAUTO = 0
Automatically selects the most appropriate compression for each image.
static final intJPEG = 1
Jpeg compression. Does not support transparency.
 

    • Field Detail

      • AUTO = 0

        public static final int AUTO
        Automatically selects the most appropriate compression for each image.
      • JPEG = 1

        public static final int JPEG
        Jpeg compression. Does not support transparency.