We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Saving as PNG or JPG generates blank image

I’m using the latest Aspose.Words for Java v14.3. With some older version it was working perfectly fine and now I get a blank white image. I’m using the code below to generate a PDF, PNG and JPG file from a word file. PDF is generated OK but images are blank. See the attached files.

com.aspose.words.Document doc = new com.aspose.words.Document(file.getAbsolutePath());
if (renderPdf)
{
    logger.debug(" Saving as PDF…");
    com.aspose.words.PdfSaveOptions saveOptions = new com.aspose.words.PdfSaveOptions();
    saveOptions.setFontEmbeddingMode(PdfFontEmbeddingMode.EMBED_NONSTANDARD);
    saveOptions.setJpegQuality(100);
    saveOptions.setUseHighQualityRendering(true);
    saveOptions.setPageMode(PdfPageMode.USE_OUTLINES);
    doc.save(pdfFile.getAbsolutePath(), saveOptions);
    logger.debug(" PDF generated. ");
}
if (renderPng)
{
    ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
    options.setPageIndex(0);
    options.setPageCount(1);
    options.setJpegQuality(100);
    options.setUseHighQualityRendering(true);
    logger.debug(" Saving as PNG…");
    doc.save(pngFile.getAbsolutePath(), options);
    logger.debug(" PNG generated. ");
}
if (renderThumbnails)
{
    ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
    options.setPageIndex(0);
    options.setPageCount(1);
    options.setJpegQuality(100);

    logger.debug(" Saving as JPEG Thumbnail…");
    doc.save(jpegFile.getAbsolutePath(), options);
    logger.debug(" JPEG generated. ");
}

Thanks in advance for fixing this issue.
Regards,
Mariusz

Hi Mariusz,

Thanks for your inquiry. I have tested the scenario using latest version of Aspose.Words for Java 14.3.0 and have not found the shared issue. Please make sure that you are using the latest version of Aspose.Words for Java 14.3.0. I have attached the output documents with this post for your kind reference. I have tested this scenario at Windows 7 (64 bit) and JDK 1.6.

If you still face issue, please share following detail for investigation purposes.

What environment are you running on?

  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Java version

I’m using also Windows 7 and Java 6. But I have all the Aspose libraries in the classpath, including Aspose.Pdf and Aspose.Imaging. Could that cause the issue?

Hi Mariusz,

Thanks for sharing the detail.

In your case, I suggest you please create a separate Java application and include only Aspose.Words Jar file to test this scenario. Please share your finding here for our reference.

Could you please share which version of Aspose.Pdf and Aspose.Imaging you are using? I will prepare the required platform to simulate the environment as of yours and test the same scenario.

I’m not sure what happened but suddenly is started working fine… Thanks anyway!

Hi Mariusz,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.