Free Support Forum - groupdocs.com

Convert a PPTX file to Image in Java

hi.
The following exception occurs when converting pptx file to image using the GroupDocs API.


java.lang.Exception: com.groupdocs.conversion.internal.c.a.ms.System.IO.FileNotFoundException: C:\Windows\system32\ko-KR
com.groupdocs.conversion.internal.c.a.ms.System.IO.FileInfo.open(Unknown Source)
com.groupdocs.conversion.internal.c.a.ms.System.IO.FileInfo.openRead(Unknown Source)
com.groupdocs.conversion.utils.wrapper.filesystem.FileInfoWrapper.openRead(Unknown Source)
com.groupdocs.conversion.handler.b.(Unknown Source)
com.groupdocs.conversion.handler.b.(Unknown Source)
com.groupdocs.conversion.handler.ConversionHandler.(Unknown Source)

The test environment is as follows:
server :: windows server 2016
webapplicationserver :: jeus7
java version :: jdk8

I would be grateful if you could reply to my e-mail.
I look forward to your quick reply
thank you.

1 Like

@yc100,

Please specify following details. We’ll then assist you accordingly:

  • API version (e.g. 19.6, 19.10)
  • Sample code
  • Problematic PPTX file

The requested details are below. Looking forward to your quick reply.

Thank you.

  1. API version (e.g. 19.6, 19.10)

19.10

  1. Sample code

String outputPath = AIScriptManager.aiProps.getProperties(“imagePath”);

       String storagePath=AIScriptManager.aiProps.getProperties("attachFilePath");

       ConversionConfig conversionConfig = new ConversionConfig();

       conversionConfig.setStoragePath(storagePath);

       conversionConfig.setOutputPath(outputPath);

       conversionConfig.setCachePath(outputPath);

       conversionConfig.setLocalesPath(storagePath);

       conversionConfig.setUseCache(false);

       SaveOptions saveOption = new ImageSaveOptions();

       saveOption.setConvertFileType(ImageSaveOptions.ImageFileType.JPEG);

       ConversionHandler conversionHandler = new ConversionHandler(conversionConfig); //I suspect that an error occurred on that line

       ConvertedDocument convertedDocumentPath = conversionHandler.<List<String>>convert(pptxPath[i], saveOption);

       int totalPage=convertedDocumentPath.getPageCount();

       for (int page = 1; page < totalPage+1; ++page)

       {

           String fileName = getFilename();

           convertedDocumentPath.save(fileName, page);

       }

       convertedDocumentPath.dispose();

  1. Problematic PPTX file
    manager00.zip (25.0 KB)

Please check the attached file

1 Like

@yc100,

Thanks for sharing the details.
We cannot reproduce this issue using version 19.10 and the code below:

ConversionConfig conversionConfig = new ConversionConfig();
ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);
ImageSaveOptions saveOptions = new ImageSaveOptions(); 
saveOptions.setConvertFileType(FileType.Jpeg); 
String guid = "D:\\Samples\\manager00.pptx";
ConvertedDocument convertedDocumentPath = conversionHandler.convert(guid, saveOptions);
int totalPage=convertedDocumentPath.getPageCount();
for (int i = 1; i <= convertedDocumentPath.getPageCount(); i++) {
	convertedDocumentPath.save("D:\\Samples\\output" + i + "." + convertedDocumentPath.getFileType(), i);
} 

See the output images.zip (489.1 KB).
However, we noticed one thing, if the presentation file is corrupted (it was damaged for some reason when I extracted it first time), you will get an exception (class com.groupdocs.conversion.internal.c.a.s.internal.da.j: Unknown file format.). We extracted the file again and performed a successful conversion.