Class ImageConverter

java.lang.Object
org.ofdrw.converter.ofdconverter.ImageConverter
All Implemented Interfaces:
Closeable, AutoCloseable, DocConverter

public class ImageConverter extends Object implements DocConverter
图片转换为OFD
Since:
2023-3-14 23:09:08
Author:
权观宇
  • Constructor Details

    • ImageConverter

      public ImageConverter(Path ofdPath) throws IOException
      创建PDF转换OFD转换器
      Parameters:
      ofdPath - 转换后的OFD文件路径
      Throws:
      IOException - 文件解析异常
    • ImageConverter

      public ImageConverter(OutputStream output) throws IOException
      创建PDF转换OFD转换器
      Parameters:
      output - 转换后的OFD流
      Throws:
      IOException - 文件解析异常
  • Method Details

    • convert

      public void convert(Path filepath, int... indexes) throws GeneralConvertException
      新建OFD页面并放入图片
      Specified by:
      convert in interface DocConverter
      Parameters:
      filepath - 待转换文件路径
      indexes - 忽略
      Throws:
      GeneralConvertException - 转换异常
    • append

      public void append(Path filepath, double width, double height)
      追加图片到新一页
      Parameters:
      filepath - 图片文件
      width - 图片在页面中宽度
      height - 图片在页面中高度
    • setPPM

      public void setPPM(double ppm)
      设置图片质量
      Parameters:
      ppm - 像素每毫米
    • setPageSize

      public void setPageSize(PageLayout pageLayout)
      设置页面尺寸
      Parameters:
      pageLayout - 页面尺寸
    • close

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