Class PDFBox

java.lang.Object
org.summerboot.jexpress.util.pdf.PDFBox

public class PDFBox extends Object
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Constructor Details

    • PDFBox

      public PDFBox()
  • Method Details

    • getFont

      public static org.apache.pdfbox.pdmodel.font.PDFont getFont(String name)
    • loadFonts

      public static int loadFonts(File fontCacheDir, File fontDir) throws IOException
      Throws:
      IOException
    • getFontFiles

      public static File[] getFontFiles()
    • getFonts

      public static Map<File,String> getFonts()
      Returns:
      <font file, fontFamily>
    • useFonts

      public static int useFonts(com.openhtmltopdf.pdfboxout.PdfRendererBuilder builder, org.apache.pdfbox.pdmodel.PDDocument doc) throws IOException
      Throws:
      IOException
    • buildDefaultAccessPermission

      public static org.apache.pdfbox.pdmodel.encryption.AccessPermission buildDefaultAccessPermission()
    • buildStandardProtectionPolicy

      public static org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy buildStandardProtectionPolicy(String userPwd, String ownerPwd)
    • buildStandardProtectionPolicy

      public static org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy buildStandardProtectionPolicy(String userPwd, String ownerPwd, org.apache.pdfbox.pdmodel.encryption.AccessPermission ap, int keyLenth)
    • html2PDF

      public static byte[] html2PDF(String html, File baseDir, org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy protectionPolicy, org.apache.pdfbox.pdmodel.PDDocumentInformation info, float pdfVersion) throws IOException
      Throws:
      IOException
    • html2PDF

      public static byte[] html2PDF(String html, File baseDir, org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy protectionPolicy, org.apache.pdfbox.pdmodel.PDDocumentInformation info, float pdfVersion, float pageWidth, float pageHeight, com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder.PageSizeUnits units) throws IOException
      Throws:
      IOException
    • pdf2Images

      public static List<byte[]> pdf2Images(byte[] pdfData, float dpi, String formatName) throws IOException
      Parameters:
      pdfData -
      dpi -
      formatName - a String containing the informal name of a format (e.g., "jpeg", "png" or "tiff".
      Returns:
      Throws:
      IOException
    • pdf2Images

      public static List<byte[]> pdf2Images(byte[] pdfData, float dpi, org.apache.pdfbox.rendering.ImageType imageType, String formatName) throws IOException
      Parameters:
      pdfData -
      dpi -
      imageType -
      formatName - a String containing the informal name of a format (e.g., "jpeg", "png" or "tiff".
      Returns:
      Throws:
      IOException
    • pdf2Images

      public static List<byte[]> pdf2Images(File pdfFile, float dpi, org.apache.pdfbox.rendering.ImageType imageType, String formatName) throws IOException
      Parameters:
      pdfFile -
      dpi -
      imageType -
      formatName - a String containing the informal name of a format (e.g., "jpeg", "png" or "tiff".
      Returns:
      Throws:
      IOException
    • pdf2Images

      public static List<BufferedImage> pdf2Images(byte[] pdfData, float dpi, org.apache.pdfbox.rendering.ImageType imageType) throws IOException
      Throws:
      IOException
    • pdf2Images

      public static List<BufferedImage> pdf2Images(File pdfFile, float dpi, org.apache.pdfbox.rendering.ImageType imageType) throws IOException
      Throws:
      IOException
    • pdf2Images

      public static List<BufferedImage> pdf2Images(org.apache.pdfbox.pdmodel.PDDocument document, float dpi, org.apache.pdfbox.rendering.ImageType imageType) throws IOException
      Parameters:
      document - make sure the caller will close the document
      dpi - 300
      imageType -
      Returns:
      Throws:
      IOException
    • images2Bytes

      public static List<byte[]> images2Bytes(List<BufferedImage> images, String formatName) throws IOException
      Parameters:
      images -
      formatName - a String containing the informal name of a format (e.g., "jpeg", "png" or "tiff".
      Returns:
      Throws:
      IOException
    • writePDF

      public static byte[] writePDF(PDFBox.Writer writer, Object dto, float pdfVersion) throws IOException
      Throws:
      IOException