Class PDFUtils

java.lang.Object
org.nuxeo.ecm.platform.pdf.PDFUtils

public class PDFUtils extends Object
Grouping miscellaneous utilities in this class.
Since:
8.10
  • Field Details

    • DEFAULT_BLOB_XPATH

      public static final String DEFAULT_BLOB_XPATH
      See Also:
    • STANDARD_14

      protected static final Map<String,org.apache.pdfbox.pdmodel.font.PDType1Font> STANDARD_14
  • Constructor Details

    • PDFUtils

      public PDFUtils()
  • Method Details

    • getStandardType1Font

      public static org.apache.pdfbox.pdmodel.font.PDType1Font getStandardType1Font(String name)
      Gets one of the Standard 14 Type 1 Fonts.
      Since:
      11.1
    • hex255ToRGB

      public static int[] hex255ToRGB(String inHex)
    • load

      public static org.apache.pdfbox.pdmodel.PDDocument load(Blob inBlob, String inPwd) throws NuxeoException
      This is just a shortcut. We often load() and openProtection().
      Parameters:
      inBlob - Input Blob.
      inPwd - Input password.
      Throws:
      NuxeoException
    • saveInTempFile

      public static FileBlob saveInTempFile(org.apache.pdfbox.pdmodel.PDDocument inPdfDoc) throws IOException
      Create a temporary PDF file and return a FileBlob built from this file.

      Mainly a utility used just by this plug-in actually.

      Parameters:
      inPdfDoc - Input PDF document.
      Returns:
      FileBlob
      Throws:
      IOException
    • saveInTempFile

      public static FileBlob saveInTempFile(org.apache.pdfbox.pdmodel.PDDocument inPdfDoc, String inFileName) throws IOException
      Throws:
      IOException
    • setInfos

      public static void setInfos(org.apache.pdfbox.pdmodel.PDDocument inPdfDoc, String inTitle, String inSubject, String inAuthor)
      Convenience method: If a parameter is null or "", it is not modified.
      Parameters:
      inPdfDoc - Input PDF document.
      inTitle - Title of the PDF document.
      inSubject - Subject of the PDF document.
      inAuthor - Author of the PDF document.
    • checkXPath

      public static String checkXPath(String inXPath)
    • closeSilently

      public static void closeSilently(org.apache.pdfbox.pdmodel.PDDocument... inPdfDocs)