Free Support Forum - aspose.com

Incomplete picture generated by wirteAsSvg () method

When I inserted shapes in PowerPoint(15750070833093.png),a part of the generated picture was missing(80102814629300.zip).

PowerPoint source file(graphics.zip).

API:com.aspose:aspose-slides:jdk16:19.11

15750070833093.png (884 Bytes)

80102814629300.zip (668 Bytes)

graphics.zip (25.4 KB)

@chenxiaoni,

I have worked with source file shared by you using Aspose.Slides 19.11 and unable to observe the issue. I have also shared my generated result with you for your kind reference. Slide_1.zip

I want to write the shape to svg instead of the whole slide.

import com.aspose.slides.IShape;
import com.aspose.slides.Presentation;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class WriteShape {

    public static void main(String[] args) {
        String basePath = "/Users/chenxiaoni/Documents/slides/";
        Presentation presentation = new Presentation(basePath + "shape.pptx");
        IShape iShape = presentation.getSlides().get_Item(0).getShapes().get_Item(0);
        String sourceName = "media/" + System.nanoTime() + ".svg";
        try {
            FileOutputStream os = new FileOutputStream(basePath + sourceName);
            iShape.writeAsSvg(os);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}

@chenxiaoni,

Can you please share complete environment details with us so that we may further investigate to help you out.

shape.pptx.zip (26.2 KB)
jdk1.8
aspose.slides
PowerPoint 2016

@chenxiaoni,

We need to know environment means which operating system you are using on your end so that we may test on that environment for further investigation.

development environment: Windows 10

@chenxiaoni,

Can you please try to use following sample code on your end and share feedback with us.

public static void svgconvert() throws FileNotFoundException{

Presentation presentation = new Presentation(path+“graphics.pptx”);
ISlideCollection slides = presentation.getSlides();

  for (int i = 0; i < slides.size(); i++) {
  	ISlide slide = presentation.getSlides().get_Item(i);

OutputStream out = new FileOutputStream(new File(path+“Java Thumbs\Thumbs\Slide_” + (i + 1) + “.svg”));

  	slide.writeAsSvg(out);
  }

I just want shape write as svg.IShape already provides the writeAsSvg () method.Why do you provide sample code for ISlide?

@chenxiaoni,

I have worked with the presentation file shared by you and have been able to observe the issue. An issue with ID SLIDEJAVA-37873 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.