We just purchased Aspose Total for Java after doing some preliminary work with the Aspose Slides demo software. I'm now using Hotfix 184.108.40.206.
I initially thought my problem had to do with the watermarking of the demo software, but the same thing happens with the licensed product.
When I first create a Presentation from scratch, there is already a blank slide in the presentation at the top - createEmptySlide() calls only add additional slides after this one.
There must be a way to prevent this first slide from occurring? I'm even unable to delete it from the presentation.
Can you help?
Also, is there a way to programmatically determine what version of aspose software is running? Is there a method or variable that returns the current version?
You should delete first empty slide before you save ppt file.
It’s not possible to delete ALL slides so if you create presentation and
immediately try to delete this slide then exception will be thrown.
There is no method to get version but you always can read or parse manifest file.
So after I create other slides, I'll be able to delete the first one.
I take it there is no way to prevent it from being created in the first place? Any plans on allowing that - this is a pretty kludgey way of doing things.
I'm looking at the manifest file in the 220.127.116.11 jar file and it only tells me it's:
Created-By: 1.6.0_06 - which is the java version.
There's no indication what version of Aspose it contains.
That is too hard (I’d even say almost impossible) to restore correct ppt strcture after deleting all slides
so currently delete first empty slide is the only workaround. Only one short line of code.
jarsigner move all information deep to the middle of manifest file.
You will find below:
Name: Aspose.Slides for Java
Implementation-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Slides for Java
Specification-Vendor: Aspose Pty Ltd
Specification-Title: Aspose.Slides for Java
Copyright: Copyright 2005-2008 Aspose Pty Ltd
Most probably 18.104.22.168 in the jar file you downloaded.
But the real version is 22.214.171.124. It was uploaded twice to the server today.
You're right - version info was buried in the middle, and I do have a version that says 126.96.36.199 - I'll download it again.
Please see the code below. It first sets the license to avoid watermark, then add a title slide and then delete the empty slide added by default. You can also see the output of this code, which I have attached with this post.
//Read the license in a stream
FileInputStream finLicense = new FileInputStream("c:/Aspose.Total.Java.lic");
//Set the license to avoid watermark
com.aspose.slides.License lic = new com.aspose.slides.License();
//Create a presentation
Presentation pres = new Presentation();
//Add the title slide
Slide slide = pres.addTitleSlide();
//Set the Title text
((TextHolder) slide.getPlaceholders().get(0)).setText("Slide Title Heading");
//Set the Sub Title Text
((TextHolder) slide.getPlaceholders().get(1)).setText("Slide Title Sub-Heading");
//Delete the empty slide which is added by default
//when you create presentation from scratch
Slide defaultEmptySlide = pres.getSlideByPosition(1);
//Write output to disk
Thanks for the extra information.
This is pretty much what I ended up doing. The problem with this is in a larger, more complicated program, we may want to save the powerpoint multiple times (to save our work), but then continue to add slides, etc. So when is the appropriate time to delete that first useless slide? Can't do it on every save - or the second time we start deleting good slides.
I ended up creating a shell around Presentation that I can use to track whether the first slide has been deleted already or not.
Another related topic -
I am already loading the Aspose Total license file - so I'm not getting the watermark anymore in the slides. However, when I get a Thumbnail image from the slide I do create, it still has the watermark on the thumbnail image that is returned.
Looks like that code must not correctly test for the license file and still puts in the watermark. Or it's a problem specifically with the Aspose.Total license file used with Aspose.Slides? I have not yet searched the forums to see if this is a known problem.
I am using the 188.8.131.52 version.
More on the thumbnail watermarking problem...
I don't see anything in the forums about watermarks still appearing in the thumbnails when using a licensed product - perhaps this is a new bug?
I also noticed that the thumbnail is not including all the objects on the slide - but there appear to be lots of talk on that, so I'll have to investigate further.
Any thoughts on the thumbnail watermarking problem?
You should call setLicense() method before you open or create a presentation.
Also check the source presentation. May be it’s already has watermark inside.
My idiotic mistake. I loaded the license key prior to the creating the presentation, but only when I was creating my own PPT. When loading an existing PPT file, I forgot to load the key.
Explains why it was "working" only half the time for me.
Thanks for your help.