Hello,
When trying to convert a smartArt object which has a part of it rotated outside of smartArt border to image the rotated part is cropped and not converted properly.
Here’s a simple code snippet I’m using to convert the smartArt to a png image:
Presentation presentation = new Presentation("smartart.pptx");
ISlide slide = presentation.getSlides().get_Item(0);
IShape shape = slide.getShapes().get_Item(0);
shape.getImage().save("smartArt.png");
I’ve also attached the original powerpoint pptx file used to repeat the issue and the result gotten.
smartart.zip (45.8 KB)
@dfinsolutions
It seems that you are experiencing an issue where parts of a rotated SmartArt object are being cropped when converting it to an image. This can happen due to the way the rendering engine handles the boundaries of the SmartArt shape.
To address this issue, you can try adjusting the dimensions of the output image to ensure that all parts of the SmartArt, including the rotated sections, are included in the final image. You can achieve this by using the ISlide.GetImage(Size)
method, which allows you to specify the width and height of the resulting image. This flexibility can help you capture the entire SmartArt object without cropping.
Here’s an example of how you might modify your code to set custom dimensions for the output image:
using Aspose.Slides;
using System.Drawing;
Presentation presentation = new Presentation("smartart.pptx");
ISlide slide = presentation.Slides[0];
IShape shape = slide.Shapes[0];
// Define the desired size for the output image
Size imageSize = new Size(800, 600); // Adjust the size as needed
shape.GetImage(imageSize).Save("smartArt.png");
Make sure to adjust the imageSize
to fit the dimensions that will encompass the entire SmartArt, including any rotated parts. This should help in preventing any cropping issues during the conversion process.
If you continue to face challenges, consider checking the Aspose documentation for more details on rendering SmartArt and other complex objects, as there may be specific nuances related to your particular use case.
For further assistance, you might also want to explore the FAQs in the Aspose documentation, which address rendering accuracy and limitations when dealing with SmartArt and other complex shapes.
If you have any more questions or need further clarification, feel free to ask!
Ok, I’ve changed getImage parameters to use shape appearance. But there is another issue, the text which is outside of the smartArt border gets rotated and moved which doesn’t match the original smartArt.
Here’s the code I’m using:
Presentation presentation = new Presentation("smartart.pptx");
ISlide slide = presentation.getSlides().get_Item(0);
IShape shape = slide.getShapes().get_Item(0);
shape.getImage(ShapeThumbnailBounds.Appearance, 4f, 4f).save("smartArt.png");
Also, attached here is the original pptx file and the image generated.
smartart.zip (105.7 KB)
@dfinsolutions,
I need some time to check the issue. I will get back to you as soon as possible.
@dfinsolutions,
Thank you for your patience. I’ve reproduced the issue with rendering text when converting the SmartArt object to an image.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESJAVA-39655
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.