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

Free Support Forum - aspose.com

Is it possible to detect image formats that aren't supported for PDF conversion

We use Aspose words, cells & slides to convert documents into PDFs. Some of these files can contain image formats that don’t appear to be supported by the conversion process - for example TIFF images.

Is there any mechanism via the Aspose APIs to detect unsupported file types, or is there any way that the conversion process could report that certain image types weren’t converted?

Thanks
Rob

@rasto68,

I have observed the issue shared by you and request you to please provide the source files along with generated output and desired output files with us. Please also first try using our latest API versions for Aspose.Cells, Aspose.Words and Aspose.Slides on your end as well before sharing the information with us.

Documents.zip (1.0 MB)

The attached zip file contains four files:

  1. A word document containing a TIFF image
  2. The result of PDFing that document using Aspose.Words 18.9
  3. A word document containing a JPEG image
  4. The result of PDFing that document using Aspose.Words 18.9

The word document containing the TIFF image is not rendered correctly as a PDF, the word document with the JPEG image is rendered correctly as a PDF

The code used to generate the PDFs is similar to:

File resultedPdf = new File(outputfile);
try
{
    Document document = new Document(inputFile);
    document.save(resultedPdf.getAbsolutePath(), new PdfSaveOptions());
}
catch (Exception ex)
{
    System.out.println("Error whilst converting!!!!!!!!!!");
    ex.printStackTrace();
    throw ex;
}
System.out.println("Conversion complete with no errors");

No exception is thrown when converting the document containing the TIFF image

@rasto68,

After an initial test with Aspose.Words for Java 18.9, we were unable to reproduce this issue on our end. Please note that Aspose.Words for Java depends upon the Java Advanced Imaging (JAI) package from Oracle in order to process some image formats such as TIFF. Please refer to Additional Dependencies section of documentation to be able to configure Native JAI and ImageIO on your machine. Hope, this helps.

Thank you,I didn’t realise there were additional dependencies.

Unfortunately for us, some of our customers use 64bit Windows based servers and the JAI release you mentioned above only supports 32bit Windows so won’t work for us. Luckily I managed to find the following project: https://github.com/jai-imageio/jai-imageio-core
I switched to using this and the documents converted correctly. Maybe this is something you could consider including in your instructions ?

@rasto68,

It is great that you were able to find an alternate JAI but we think it might be slow as compared to the “native version” that we recommend in our documentation. Please also note that 64-bit Windows can run 32-bit Windows applications without any problems. We have also successfully installed the same 32-bit native JAI and ImageIO libraries (which are mentioned in our documentation) on 64-bit Windows on our end. You can also check your ‘C:\Program Files (x86)’ folder for installed (and working) 32-bit Windows applications.