Package org.nuxeo.ecm.platform.pdf
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 Summary
Fields Modifier and Type Field Description static String
DEFAULT_BLOB_XPATH
protected static Map<String,org.apache.pdfbox.pdmodel.font.PDType1Font>
STANDARD_14
-
Constructor Summary
Constructors Constructor Description PDFUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
checkXPath(String inXPath)
static void
closeSilently(org.apache.pdfbox.pdmodel.PDDocument... inPdfDocs)
static org.apache.pdfbox.pdmodel.font.PDType1Font
getStandardType1Font(String name)
Gets one of the Standard 14 Type 1 Fonts.static int[]
hex255ToRGB(String inHex)
static org.apache.pdfbox.pdmodel.PDDocument
load(Blob inBlob, String inPwd)
This is just a shortcut.static FileBlob
saveInTempFile(org.apache.pdfbox.pdmodel.PDDocument inPdfDoc)
Create a temporary PDF file and return a FileBlob built from this file.static FileBlob
saveInTempFile(org.apache.pdfbox.pdmodel.PDDocument inPdfDoc, String inFileName)
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.
-
-
-
Field Detail
-
DEFAULT_BLOB_XPATH
public static final String DEFAULT_BLOB_XPATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
closeSilently
public static void closeSilently(org.apache.pdfbox.pdmodel.PDDocument... inPdfDocs)
-
-