Free Support Forum - groupdocs.com

Unable to convert PNG file properly from PPT


#1

Hello,


Below is my environment:
- GroupDocs.Conversion 1.3.0 Java
- Oracle JDK 8

I tried to generate page 2 of the PPT files. It gave me the messy image (please refer to result_page_2.png).

Thanks

#2
Hello,

Thank you for your inquiry.

We have tested your file and can't reproduce the same issue at our side. For us the file is converted well, as you can see on a screenshot.

Could you please share with us full code example that you use for the conversion and we will investigate it .

----------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

Hello Evgen,


Thank you for your reply.

Here is my code

private static final Config CONFIG = new Config();
private static final ConversionHandler CONVERSION_HANDLER = new ConversionHandler(CONFIG);
@Override
public OutputStream getDocContent(byte[] contents, String fileName, int pageNumber) throws Exception {
long startTime = System.currentTimeMillis();
try {
return getPage(contents, fileName, pageNumber);
} catch (Exception e) {
logger.error(“Error occurred while getting contents of document: {}”, e.getMessage(), e);
throw new Exception(“Error occured while getting contents of the document”);
} finally {
long finish = System.currentTimeMillis();
logger.info(“Time taken to convert bytes (fileName: {}, page:{}) to image : {} ms”, fileName, pageNumber,
(finish - startTime));
}
}

private ByteArrayOutputStream getPage(byte[] fileContents, String fileName, int pageNum) throws Exception {
ByteArrayOutputStream bos = null;
ByteArrayInputStream bais = null;
ByteArrayInputStream result = null;
try {
bais = new ByteArrayInputStream(fileContents);
ImageSaveOptions options = new ImageSaveOptions();
options.setSaveFileType(FileType.PNG);
options.setResolution(120);
options.setPage(pageNum);
try {
result = CONVERSION_HANDLER.convertToImage(bais, fileName, options);
} catch (ConversionException e) {
throw e;
}
if (result != null) {
bos = new ByteArrayOutputStream();
try {
IOUtils.copy(result, bos);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
} finally {
try {
if (result != null) {
result.close();
}
} catch (IOException e) {
logger.error("Error occurred while closing stream: " + e.getMessage());
}
try {
if (bais != null) {
bais.close();
}
} catch (IOException e) {
logger.error("Error occurred while closing stream: " + e.getMessage());
}
}
return bos;
}

#4
Hello,

Thank you for your code example.

We have tested your scenario , but still can't reproduce the issue at our side. Seems that the issue depends from the missed fonts on your environment. Could you please specify next :

- your OS
- the exact version of the Java library
- a log from Maven console (the library should notify about the missed fonts)

Note: if you see the notification in console log about the missed fonts, then you should install these fonts.

We will wait for your details.

-----

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#5

Hello,


Here is my environment details:
- Windows 7 Enterprise Service Pack 1 (64 bit)
- JDK 8u25 64 bit

There is no missing font in the log.
As you see in the PPT file in the attachment. The font on page 2 is Arial and Arial Unicode MS.

Thanks

#6
Hello,

We really sorry for the issue that you have on your side. We have checked all options but unfortunately we can't reproduce the issue. Maybe, if you will prepare for us some small demo example with which we can reproduce the issue - then we will check it and will try to find a reason of the issue.

We will wait your demo example and will help you ASAP.

------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+