Convert to List of GroupDocsInputStream for version 17.12-Java


#1

Hello guys,

Does anyone knows how to convert to List of GroupDocsInputStream for the new version 17.12-Java?

Old version
List gis = m_oHandler.<List> convert(fileName,
m_oImageOptions)

Current version
ConvertedDocument convertedDocument = conversionHandler.convert(“filename”, saveOption);

Thanks in advance.

Regards,
Erich


#2

@ejlotilla,

Thank you for taking interest in GroupDocs.Conversion for Java and posting your concerns. In latest version of the API, converted results are only handled by ConvertedDocument class as follows:

ConvertedDocument convertedDocumentStream = conversionHandler
.<List<GroupDocsInputStream>> convert(fileName, new ImageSaveOptions());

However, we are further investigating this scenario at our end. Your investigation ticket ID is CONVERSIONJAVA-516. As we have any update, we shall inform you.


#3

Thanks for the reply. But how to get the List of GroupDocsInputStream from the object convertedDocumentStream ? Because convertedDocumentStream got few methods only like save, also casting to a list doesn’t work. Thank you.


#4

@ejlotilla,

We are investigating this scenario at our end. You shall be notified about the outcomes.


#5

Thanks a lot.


#6

@ejlotilla,

You are welcome.


#7

@ejlotilla,

Please follow the code given below. Hope it will help you.

// Instantiating the conversion handler
ConversionHandler handler = new ConversionHandler(config);

ConvertedDocument result = handler.convert(sourceFile, new ImageSaveOptions());

ArrayList<InputStream> streams = new ArrayList<>();
for (int i = 1; i <= result.getPageCount(); i++) {
    GroupDocsOutputStream stream = new GroupDocsOutputStream();
    result.save(stream, i);
    stream.setPosition(0);
    streams.add(stream.toInputStream());
}

// Do anything with converted streams
for (InputStream stream : (Iterable<InputStream>) streams) {
    stream.close();
}

#8

thanks a lot.


#9

@ejlotilla,

You are welcome.