Class TextConverter

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

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

    • TextConverter

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

      public TextConverter(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(String txt)
      追加文本,文本将新起一行
      Parameters:
      txt - 文本
    • setPageSize

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

      public void setFontSize(double fontSize)
      设置字号
      Parameters:
      fontSize - 字号,单位:毫米(mm)
    • close

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