public class PDFInfo extends Object
toHashMap()
or
toString()
) or via individual getters.
The PDF is parsed only at first call to run()
. Values are cached during first call.
About page sizes, see PDF page boxes for details. Here, we get the info from the first page only. The dimensions are in points. Divide by 72 to get it in inches.
Constructor and Description |
---|
PDFInfo(Blob inBlob)
Constructor with a Blob.
|
PDFInfo(Blob inBlob,
String inPassword)
Constructor for Blob + encrypted PDF.
|
PDFInfo(DocumentModel inDoc)
Constructor with a DocumentModel.
|
PDFInfo(DocumentModel inDoc,
String inXPath,
String inPassword)
Constructor for DocumentModel + encrypted PDF
|
Modifier and Type | Method and Description |
---|---|
String |
getAuthor() |
String |
getContentCreator() |
Calendar |
getCreationDate() |
float |
getCropBoxHeightInPoints() |
float |
getCropBoxWidthInPoints() |
String |
getFileName() |
long |
getFileSize() |
String |
getKeywords() |
float |
getMediaBoxHeightInPoints() |
float |
getMediaBoxWidthInPoints() |
Calendar |
getModificationDate() |
int |
getNumberOfPages() |
String |
getPageLayout() |
String |
getPdfVersion() |
org.apache.pdfbox.pdmodel.encryption.AccessPermission |
getPermissions() |
String |
getProducer() |
String |
getSubject() |
String |
getTitle() |
String |
getXmp() |
boolean |
isEncrypted() |
void |
run()
After building the object with the correct constructor, and after possibly having set some parsing property
(
setParseWithXMP() , for example), this method will extract the information from the PDF. |
void |
setParseWithXMP(boolean inValue)
If set to true, parsing will extract PDF.
|
DocumentModel |
toFields(DocumentModel inDoc,
HashMap<String,String> inMapping,
boolean inSave,
CoreSession inSession)
The
inMapping map is an HashMap where the key is the xpath of the destination field, and the value
is the exact label of a PDF info as returned by toHashMap() . |
HashMap<String,String> |
toHashMap()
Return all and every parsed info in a String
HashMap . |
String |
toString()
Wrapper for
toHashMap().toString() |
public PDFInfo(Blob inBlob, String inPassword)
inBlob
- Input blob.inPassword
- If the PDF is encrypted.public PDFInfo(DocumentModel inDoc)
file:content
xpath to get the blob from the
document.inDoc
- Input DocumentModel.public PDFInfo(DocumentModel inDoc, String inXPath, String inPassword)
If null
or "", it is set to the default
file:content
value.
inDoc
- Input DocumentModel.inXPath
- Input XPath.inPassword
- If the PDF is encrypted.public void setParseWithXMP(boolean inValue)
The value cannot be modified if run()
already has been called.
inValue
- true to extract XMP.public void run() throws NuxeoException
setParseWithXMP()
, for example), this method will extract the information from the PDF.
After extraction, the info is available through getters: Either all of them (toHashMap()
or
toString()
) or individual info (see all getters).
NuxeoException
public HashMap<String,String> toHashMap()
HashMap
.
Possible values are:
public DocumentModel toFields(DocumentModel inDoc, HashMap<String,String> inMapping, boolean inSave, CoreSession inSession)
inMapping
map is an HashMap where the key is the xpath of the destination field, and the value
is the exact label of a PDF info as returned by toHashMap()
. For example:
pdfinfo:title=Title
pdfinfo:producer=PDF Producer
pdfinfo:mediabox_width=Media box width
...
If inSave
is false, inSession can be null.
inDoc
- Input DocumentModel.inMapping
- Input Mapping.inSave
- Whether should save.inSession
- If is saving, should do it in this particular session.public int getNumberOfPages()
public float getMediaBoxWidthInPoints()
public float getMediaBoxHeightInPoints()
public float getCropBoxWidthInPoints()
public float getCropBoxHeightInPoints()
public long getFileSize()
public boolean isEncrypted()
public String getContentCreator()
public String getFileName()
public String getKeywords()
public String getPageLayout()
public String getPdfVersion()
public String getProducer()
public String getSubject()
public Calendar getCreationDate()
public Calendar getModificationDate()
public org.apache.pdfbox.pdmodel.encryption.AccessPermission getPermissions()
Copyright © 2018 Nuxeo. All rights reserved.