I’m using Aspose.Slides for Java 2.7.0. I am working with some PPT files whose slides have custom dimensions. For example, a set of these files have slides which show up in PowerPoint’s Page Setup dialog as having width 11 inches, and height 6 inches. If I create a Presentation from an InputStream, and then save, say, a PNG thumbnail, the PNG is standard dimensions: 720x540. This is obviously causing some cropping on my 11"x6" slides whose aspect ratio is clearly different. This is the case whether I specify a Dimension or use the x/y scale value form of Slide.getThumbnail(). I have also tried Presentation.setSlideSizeType(SlideSizeType.CUSTOM) and Presentation.setSlideSize(new Point(1100, 600)), but this ends up producing bizarrely undersized and highly cropped thumbnails, so presumably I’m not on the right track there.
Should the Presentation(InputStream) constructor be detecting slide dimensions for me? If not, how do I set it manually?
Thanks for your reply. I have been unable to reproduce the issue as a test case outside the application in which I am trying to embed Aspose.Slides. That is, the process worked exactly as expected in testing. Obviously the issue is in my in-app code.
Thanks for your time.
For the record, the problem was that in the application I was cloning the Presentation object to perform some text replacement on it. Evidently, the cloning procedure described here:
isn’t quite enough. Obviously I need to copy over other properties including slide dimensions. Is there an easy way to do this, or a good implementation published somewhere?
Thanks for bearing with me.
1. I have a PPT file that uses a custom slide size of 11" x 6".
2. I create a Presentation using Presentation(InputStream) constructor.
3. I need to clone the Presentation. Initially, I used the method here:
4. When that cloned Presentation was converted to PNG, the result was the 11"x6" slide clipped onto a standard sized slide.
5. The issue is that the method proposed in the URL above literally just clones the Slide objects. What I needed to do was call setSlideSize() and setSlideSizeType() on the cloned Presentation using the values from getSlideSize() and getSlideSizeType() from the original Presentation. Now the cloned Presentation uses 11"x6" slides, and the PNG output is perfect.
Basically, I solved the problem. It sure would be great if Presentation implemented java.lang.Cloneable, though, and exposed a simple clone() method that created an exact clone.