Aspose Slide: Convert the InputStream into File (Return Type)

Hi Team,


I have a list of Pages, We need to iterate each page and store in InputStream. Finally we need to merge into a Single File.

Here is the code that I have written, Can you please modify this :

Code***

public File buildPPT(final List pages) throws ECMException {

File finalPPTTempFile = null;
InputStream inputPPTStream = null;
final Map<InputStream, Boolean> inputStreamMap = new LinkedHashMap<InputStream, Boolean>();

try {
final XMLSlideShow finalPPT = new XMLSlideShow();

if(!pages.isEmpty()){

for (int pageCnt = 0; pageCnt < pages.size(); pageCnt++) {
final ECMPage page = (ECMPage) pages.get(pageCnt);
final boolean is_active = page.getBooleanAttributeValue(ECMUtils.ECM_IS_ACTIVE_ATTR);
if (page != null && is_active) {
if (page.getContentSize() > 0) {
inputPPTStream = page.getContent();
final XMLSlideShow src = new XMLSlideShow(inputPPTStream);
for (final XSLFSlide srcSlide : src.getSlides()) {
final XSLFSlide newSlide = finalPPT.createSlide();
newSlide.setFollowMasterGraphics(true);
// Apply the background

if (pageCnt == 0) {
newSlide.setFollowMasterGraphics(true);
newSlide.getSlideMaster().importContent(srcSlide.getSlideMaster());
newSlide.importContent(srcSlide);
newSlide.getSlideShow().setPageSize(srcSlide.getSlideShow().getPageSize());
}
newSlide.importContent(srcSlide);
// call update slide number
updateSlideNumber(newSlide, pageCnt + 1);
}
} else {
DfLogger.warn(this, “The Slide : " + page.getSingleAttribute(TITLE) + " was not included in Build Presenation because it seems to be corrupted.”, null, null);
}
}
}

// HERE WE HAVE TO MERGE THE PPT AND RETURN AS A FILE

}
} catch (ECMException e) {
throw new ECMException(e, e.getMessage());
} catch (IOException e) {
throw new ECMException(e, e.getMessage());
}
return finalPPTTempFile;
}

Simple, please provide the code snippet to merge PPT files from InputStream

Input for this will be : InputStream/InputStream Map
OutPut for this will be : File

Hi Kranthi,

Your code seems to be very ambiguous and I am not clear what you are doing. What document / pages are you passing as input stream? If possible, please share a sample application with us to get a better understanding of your requirement so we can assist you better.

Thanks & Regards,

Simple, please provide the code snippet to merge PPT files from InputStream

Input for this will be : InputStream/InputStream Map
OutPut for this will be : File

Hi Kranthi,

I have shared the sample code in the below forum post which takes two PPTX files as input stream and merge them to generate a pptx file.

Please try that code and let us know if you face any issue. If your requirement is different, please explain with some more details (as requested in the previous reply).

Thanks & Regards,

Getting Page Not Found on click of the above link

Hi,

I have fixed the issue with the above link. Please try it and let us know if you still face any issue.

Thanks & Regards,