Docx to PDF with compress images option produces scrambled, unrecognizable images


We are trying to convert docx->pdf, and we are providing an image quality value for compression. The resulting pdf document contains images that are scrambled and unrecognizable.

Product: GroupDocs.Conversion
Versions Tested: 21.10.1, 22.3
OSs Tested: Linux Red Hat 8.3, macOS Catalina

Sample Code:

private static void wordToPdf() throws Exception {
    try (InputStream is = WordConvert.class.getClassLoader().getResourceAsStream("sample_image_doc.docx");
         FileOutputStream fos = new FileOutputStream("converted_docx.pdf")) {

        ConverterSettings converterSettings = new ConverterSettings();
        WordProcessingLoadOptions wordDocLoadOptions = new WordProcessingLoadOptions();
        Converter pdfConvertor = new Converter(is, wordDocLoadOptions, converterSettings);

        PdfOptions pdfOptions = new PdfOptions();
        PdfConvertOptions convertOptions = new PdfConvertOptions();
        PdfOptimizationOptions pdfOptimizationOptions = new PdfOptimizationOptions();
        pdfConvertor.convert(fos, convertOptions);

Sample Document:
sample_image_doc.docx (1.8 MB)

Produced Output:
converted_docx.pdf (42.1 KB)


We are investigating this issue. Your investigation ticket ID is CONVERSIONJAVA-1678.


The workaround is to remove the following line from your code:


Let us know if issue persists.