Class SVGExporter

java.lang.Object
org.ofdrw.converter.export.SVGExporter
All Implemented Interfaces:
Closeable, AutoCloseable, OFDExporter

public class SVGExporter extends Object implements OFDExporter
OFD SVG转换器
Since:
2023-3-8 21:45:48
Author:
权观宇
  • Constructor Details

    • SVGExporter

      public SVGExporter(Path ofdFilePath, Path imgDirPath) throws IOException
      构造图片转换器
      Parameters:
      ofdFilePath - 待转换OFD文件
      imgDirPath - 生成SVG存放目录
      Throws:
      IOException - 文件解析异常
    • SVGExporter

      public SVGExporter(InputStream ofdInput, Path imgDirPath) throws IOException
      构造图片转换器
      Parameters:
      ofdInput - 待转换OFD文件流,该流由调用者负责关闭
      imgDirPath - 生成SVG存放目录
      Throws:
      IOException - 文件解析异常
    • SVGExporter

      public SVGExporter(Path ofdFilePath, Path imgDirPath, double ppm) throws IOException
      构造图片转换器
      Parameters:
      ofdFilePath - 待转换OFD文件
      imgDirPath - 生成SVG存放目录
      ppm - 转换SVG质量,每毫米像素数量(Pixels per millimeter)
      Throws:
      IOException - 文件解析异常
    • SVGExporter

      public SVGExporter(InputStream ofdInput, Path imgDirPath, double ppm) throws IOException
      构造图片转换器
      Parameters:
      ofdInput - 待转换OFD文件流,该文件流由调用者负责关闭
      imgDirPath - 生成SVG存放目录
      ppm - 转换SVG质量,每毫米像素数量(Pixels per millimeter)
      Throws:
      IOException - 文件解析异常
  • Method Details

    • export

      public void export(int... indexes) throws GeneralConvertException
      导出指定OFD页为SVG
      Specified by:
      export in interface OFDExporter
      Parameters:
      indexes - 页码序列,如果为空表示全部页码(注意:页码从0起)
      Throws:
      GeneralConvertException - 转换异常
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getSvgFilePaths

      public List<Path> getSvgFilePaths()
      获取已经转换完成的页面的图片路径
      Returns:
      页面图片路径
    • setPPM

      public void setPPM(double ppm)
      设置转换SVG质量

      请在调用 export(int...) 方法之前设置PPM!

      Parameters:
      ppm - 每毫米像素数量(Pixels per millimeter)