com.aspose.words

Class PdfImageColorSpaceExportMode

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

Utility class containing constants. Specifies how the color space will be selected for the images in PDF document.

Example:

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

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setImageCompression(PdfImageCompression.JPEG);
pdfSaveOptions.getDownsampleOptions().setDownsampleImages(false);

doc.save(getArtifactsDir() + "PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions);

PdfSaveOptions pdfSaveOptionsA1B = new PdfSaveOptions();
pdfSaveOptionsA1B.setCompliance(PdfCompliance.PDF_A_1_B);
pdfSaveOptionsA1B.setImageCompression(PdfImageCompression.JPEG);
pdfSaveOptionsA1B.getDownsampleOptions().setDownsampleImages(false);
// Use JPEG compression at 50% quality to reduce file size
pdfSaveOptionsA1B.setJpegQuality(100);
pdfSaveOptionsA1B.setImageColorSpaceExportMode(PdfImageColorSpaceExportMode.SIMPLE_CMYK);

doc.save(getArtifactsDir() + "PdfSaveOptions.ImageCompression.PDF_A_1_B.pdf", pdfSaveOptionsA1B);

PdfSaveOptions pdfSaveOptionsA1A = new PdfSaveOptions();
pdfSaveOptionsA1A.setCompliance(PdfCompliance.PDF_A_1_A);
pdfSaveOptionsA1A.setExportDocumentStructure(true);
pdfSaveOptionsA1A.setImageCompression(PdfImageCompression.JPEG);
pdfSaveOptionsA1A.getDownsampleOptions().setDownsampleImages(false);

doc.save(getArtifactsDir() + "PdfSaveOptions.ImageCompression.PDF_A_1_A.pdf", pdfSaveOptionsA1A);

Field Summary
static final intAUTO = 0
Aspose.Words automatically selects the most appropriate color space for each image.
static final intSIMPLE_CMYK = 1
Aspose.Words coverts RGB images to CMYK color space using simple formula.
 

    • Field Detail

      • AUTO = 0

        public static final int AUTO
        Aspose.Words automatically selects the most appropriate color space for each image.

        Most of the images are saved in RGB color space. Also Indexed and Grayscale color spaces may be used. CMYK color space is never used.

        For some images the color space may be different on different platforms.

      • SIMPLE_CMYK = 1

        public static final int SIMPLE_CMYK
        Aspose.Words coverts RGB images to CMYK color space using simple formula.

        Images in RGB color space are converted to CMYK using formula: Black = minimum(1-Red,1-Green,1-Blue). Cyan = (1-Red-Black)/(1-Black). Magenta = (1-Green-Black)/(1-Black). Yellow = (1-Blue-Black)/(1-Black). RGB values are normalized - they are between 0 and 1.0.