Class ImageExporter

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

public class ImageExporter extends Object implements OFDExporter
OFD图片转换器
Since:
2023-3-8 19:50:52
Author:
权观宇
  • Constructor Details

    • ImageExporter

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

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

      public ImageExporter(Path ofdFilePath, Path imgDirPath, String imageType, double ppm) throws IOException
      构造图片转换器
      Parameters:
      ofdFilePath - 待转换OFD文件
      imgDirPath - 生成图片存放目录
      imageType - 生成图片的格式,如 JPG、PNG、GIF、BMP
      ppm - 转换图片质量,每毫米像素数量(Pixels per millimeter)
      Throws:
      IOException - 文件解析异常
    • ImageExporter

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

    • export

      public void export(int... indexes) throws GeneralConvertException
      导出指定OFD页为图片
      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
    • getImgFilePaths

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

      public String getImageType()
      获取转换图片类型
      Returns:
      图片类型
    • setPPM

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

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

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