无法正确读取PPT幻灯片转换成svg格式后的属性

问题描述:
Aspose.Slide 无法正确读取PPT幻灯片转换成svg格式后的属性

开发环境:Java8 Win10系统
工具包版本Aspose.Slide 19.11

使用幻灯片文件见附件:
Svg.zip (29.6 KB)

问题1:
画笔画出来的图案转SVG之后会损失一定的图片质量,转换之前的效果如图:SVG原图1.png (3.2 KB)
转换之后的效果如图:SVG转换效果图1.png (1.9 KB)

可以看出两者存在差异的。

问题2:
工具包无法读出SVG本身的宽高
需要读取的原幻灯片形状如图:SVG原图2.png (15.4 KB)
但是使用代码读取数据时,仅仅能够读取到如下部位的宽高:SVG读出宽高部位.png (18.2 KB)

没有获取到图中形状的小尾巴部位

使用到的Java实例代码如下

package com.xh.slides.examples.Slides.Shapes;

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

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

/**
 * @author xwj
 * @date 2019/12/16 0016 9:08
 * @description 验证svg画笔图案
 */
public class GetSvgShape {

    public static void main(String[] args) {
        Presentation pres = new Presentation("E:\\document\\Svg.pptx");
        //读取第一张幻灯片
        ISlide slide1 = pres.getSlides().get_Item(0);
        for (IShape shape : slide1.getShapes()) {
            String filepath = write(shape);
            System.out.println(filepath);
        }

        //读取第二张幻灯片
        ISlide slide2 = pres.getSlides().get_Item(1);
        for (IShape shape : slide2.getShapes()) {
            String filepath = write(shape);
            double width = shape.getWidth();
            double height = shape.getHeight();
            System.out.println(filepath);
            System.out.println("shape高度:" + height);
            System.out.println("shape宽度:" + width);
        }

    }
    public static String write(IShape shape) {
        String sourceName = "E:\\document\\svg" + System.nanoTime() + ".svg";
        try {
            FileOutputStream os = new FileOutputStream(sourceName);
            shape.writeAsSvg(os);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return sourceName;
    }

}

运行结果如下

E:\document\svg1383026244200.svg
E:\document\svg1383220732500.svg
shape高度:211.80575561523438
shape宽度:322.2523498535156

Process finished with exit code 0

@ ciyuan9,

我已观察到您共享的问题。

我们的问题跟踪系统中已创建ID为SLIDESJAVA-38001的问题,以进一步调查和解决该问题。

我们的问题跟踪系统中已创建了ID为SLIDESJAVA-38002的问题,以进一步调查和解决该问题。

该线程已与问题关联,因此一旦问题解决,您可能会收到通知。

1 Like

The issues you have found earlier (filed as SLIDESJAVA-38002,SLIDESJAVA-38001) have been fixed in this update.