We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Should custom slide dimensions be detected automatically?

Hello,



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?

Hi Paul,


I have tried to understand the issue shared by you. When you give parameters scales x, y in getThumbnail() method, it gets the actual slide size. If there is some issue then kindly share the source presentation, along with code snippet and generated out put for necessary investigation on my end.

Many Thanks,

Hi Mudassir,



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.

Hi Mudassir,



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:



http://www.aspose.com/documentation/java-components/aspose.slides-for-java/presentations-with-huge-size-after-cloning.html



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?

Hi Paul,


I have tried to understand the requirements shared by you and unfortunately have not been able to completely understand them. It will be so nice of you if you may please share the sample project along with the presentation depicting what actually is needed. Also, please share complete requirements so that I may work over them.

Many Thanks,

Hi Mudassir,



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:



http://www.aspose.com/documentation/java-components/aspose.slides-for-java/presentations-with-huge-size-after-cloning.html



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.

Hi Paul,


I am sorry for not getting your point earlier. You did perfectly right and that is the actual way. Actually, the new presentation object always has the default slide size. The cloned slides will also have the default slide size because the slide size property is something that is set on presentation level and cloning is done on slides level. Moreover, the feature of cloning intends to combine the slides from various presentation sources in a single presentation having different slide sizes. Since, slide size is set on presentation level so all cloned slides will get the same standard size as that is set in target presentation. You can set the slide size appropriately afterwards. Hope, I have cleared the reason for not having a cloning option with slide size here. Please share, if I may help you further.

Many Thanks,