How can i pass 5 presentations dynamically to merge using java

Dear sir,

I am sending my java class files
1) how can i find the file path after browse ...that file i have to pass in presentation parameters...
2) ho can i pass multiple presentations atleast 5 to merge

Please find the above attached file and let me know


Hi Naidu,

I have observed the sample code shared by you but unfortunately cannot use that in my environment. However, I have worked over your requirements and have simplified the sample code and has enabled it to merge N presentations. Please remember that at any given time only slides from one presentation can be copied to another and it is a sequential approach. However, I have made an approach with which you will pass all presentation files to a function call only once and get a merged presentation with slides from N presentations.Please find the attached sample code for your kind reference. I have only modified the Aspose.Slides related portion in the files and have commented the old code that is now replaced with new one. As far as your question regarding point 1 in your query, I have not been able to understand. Can you please share more details about it. Is it related to Aspose.Slides or some limitation on your end. If it is related to Aspose.Slides, you are more than welcome to share the details regarding point 1 and I will try my best to answer that.

Many Thanks,

hi

what ever the code you are shared is not working in my environment after adding these
list.add(“D:/” + user);
list.add(“D:/” + pass);
list.add(“D:/” + user1);
list.add(“D:/” + pass1);
list.add(“D:/” + pass2);
Presentation outputPres=Mergeclonepress.getClonedPres(list);its not loading
files is not merging can you please check one and let me know

1) 1st point of query is list.add(“D:/” + user); i want to pass “D:/bhat.ppt” to list.add(user); like this

Hi sir,

i am sending jpg file
1) to find the exact file path after browse

2) what ever code you shared me its not working can you please check and let me know!

Hi Naidu,

I have observed the image shared by you and like to share that for the requirement mentioned in your point 1, you need to copy the complete path+file name given in browse field to array list. In the sample code that I modified for you by using your class I just added the presentation paths that were given in Presentation() constructor to ArrayList. You need to copy the copy the complete content of Browse field to ArrayList. The ArrayList will hold N presentation path+ file names.

For your second point, I like to share that the following method that I have shared with you in my previous post is capable of merging N presentations together. It traverse through every item in ArrayList which is a path+file name of a valid presentation and copy the slides to target presentation.


public static Presentation getClonedPres( java.util.List list)
{
Presentation srcPres=null;
Presentation targetPres=new Presentation();
for(int a=0;a<list.size();a++)
{
srcPres=new Presentation(list.get(a).toString());
com.aspose.slides.Collections.SortedList sList=new com.aspose.slides.Collections.SortedList();
for (int i = 1; i <= srcPres.getSlides().getLastSlidePosition(); i++)
{
Slide srcSlide = srcPres.getSlideByPosition(i);
srcPres.cloneSlide(srcSlide, targetPres.getSlides().getLastSlidePosition() + 1, targetPres, sList);
}
}
return targetPres;

}


I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,

hi sir,


how can i find browse file path dynamically in servlets or in java
that file i have to pass in presentation parameters…



Please find the attached file and let me know !

Thanks & Regards
Naidu Rv

Hi Naidu,

I like to share that you need to add the path string with file name to ArrayList. The User String in your code has the path+file name in it. So, based on your code that you have shared earlier, you need only to pass the string to array list as under.

java.util.List list=new java.util.ArrayList();

list.add( user);
list.add(pass);
list.add(user1);
list.add(pass1);


Please share, if I may help you further in this regard.

Many Thanks,

Hi sir,


I have a list of .pptx in one folder i want to merge all ppts
public static Presentation getClonedPres( java.util.List list)
{
Presentation srcPres=null;
Presentation targetPres=new Presentation();
for(int a=0;a<list.size();a++)
{
srcPres=new Presentation(list.get(a).toString());
com.aspose.slides.Collections.SortedList sList=new com.aspose.slides.Collections.SortedList();
for (int i = 1; i <= srcPres.getSlides().getLastSlidePosition(); i++)
{
Slide srcSlide = srcPres.getSlideByPosition(i);
srcPres.cloneSlide(srcSlide, targetPres.getSlides().getLastSlidePosition() + 1, targetPres, sList);
}
}
return targetPres;

}This method is for .ppts </span>

I want this method for .pptx please share asap…

Thanks & Regards
Naidu.RV

Hi Naidu,

Please try using the following sample code to serve the purpose. Please share, if I may help you further in this regard.

public static PresentationEx getClonedPres( java.util.List list)
{
PresentationEx srcPres=null;
PresentationEx targetPres=new PresentationEx();
SlideExCollection targetSlides=targetPres.getSlides();
for(int a=0;a<list.size();a++)
{
srcPres=new PresentationEx(list.get(a).toString());
for (int i = 0; i <= srcPres.getSlides().size(); i++)
{
SlideEx srcSlide = srcPres.getSlides().get_Item(i);
targetSlides.addClone(srcSlide);
}
}
return targetPres;

}


Many Thanks,

Hi,


I am sending my java classes please find the attached file and let me know!

I am getting this exception

log4j:WARN No appenders could be found for logger (com.aspose.slides.obfuscated.bhy).
log4j:WARN Please initialize the log4j system properly.
Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 37, Size: 37
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.aspose.slides.pptx.SlidesEx.get(SourceFile:58)
at pptxapplication.Mergeclonepress.getClonedPres(Mergeclonepress.java:35)
at pptxapplication.Pptxapplication.main(Pptxapplication.java:56)
Java Result: 1

Thanks & Regards
Naidu RV

Hi Naidu,

I have observed that you have been using Aspose.Slides for Java 2.6.0 in your sample project, which is fairly old version. I have tailored the code on my end using Aspose.Slides for Java 8.1.0 and it is working perfectly fine. I have changed the paths in the attached project as per my machine so you may please update them as per your environment. Please share, if I may help you further in this regard.

Many Thanks,

Hi sir,

I just used what ever you are shared me !

But i am getting this exception need help in this regard..
=============EXCEPTION======================
Exception in thread "main" java.lang.SecurityException: class "com.aspose.slides.SlidesEx"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:806)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:625)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
Java Result: 1
=========================================

Thanks & Regards

Hi Naidu,


I have observed the stack trace shared by you. Can you please make sure that you are using Aspose.Slides for Java 8.1.0 only in your project. Secondly, please share the sample source presentations with me as with the presentations that I have used there has been no issue. Please remember that you are using PPT presentations and loading them using PresentationEx. At the moment there is limited support available for loading PPT using PresentationEx.

Please share the sample presentations, JDK version used, Operating system details and environment configurations that are used on your end. I will be able to investigate the issue further on my end once the requested information will be shared from your end.

Many Thanks,

Hi Mudassir Fayyaz,



Please find the attached file and let me know!

Iam using

1) netbeans 7.0.1

2) Apache Tomcat 7.0.14

3) jdk1.6.0_26

4) Windows 7

5) =======Exception=========

Exception in thread “main” java.lang.SecurityException: class “com.aspose.slides.SlidesEx”'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:806)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:625)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
Java Result: 1
BUILD SUCCESSFUL (total time: 9 seconds)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

=======Exception=============


Thanks & Regards

Hi


Please find the attached pptx files and let me know !



Thanks & Regards

Hi Naidu,

I have worked with the sample project shared by you and like to share that it is the same old project that you have shared earlier and I have shared the updated project for that in my last post. I have modified the project again and have shared that again for your kind reference. You are using old legacy API and I request you to please use Aspose.Slides for Java 8.1.0 on your end. Please refer to info.png for your kind reference. Please also visit this web link for your kind reference as well for SecurityException you are having. It seems that you are referencing two API versions of Aspose.Slides for Java in your application, which is wrong. Please use the attached sample code as it is and only check the file paths as per your environments only.

Many Thanks,

Which is the jar for PresentationEx. I cant find it in Aspose-slides 17.6. Have I used the wrong jar?

@hrishikesh.chikhale,

I like to share that PresentationEx class that you are referring belongs to legacy API that has been phased out since 2014. I suggest you to please try using latest Aspose.Slides for Java 17.6 that has Presentation class for loading the presentation. I suggest you to please visit this documentation link for latest sample codes to explore different API features.

Many Thanks,

Mudassir Fayyaz