public abstract class DocumentInfo extends Object
Modifier and Type | Field and Description |
---|---|
static String |
KEY_AUTHOR |
static String |
KEY_CREATIONDATE |
static String |
KEY_CREATOR |
static String |
KEY_KEYWORDS |
static String |
KEY_MODDATE |
static String |
KEY_PRODUCER |
static String |
KEY_SUBJECT |
static String |
KEY_TITLE |
Constructor and Description |
---|
DocumentInfo() |
Modifier and Type | Method and Description |
---|---|
abstract String |
getAuthor()
Returns the document's author.
|
abstract Date |
getCreationDate()
Returns the document's creation date.
|
abstract String |
getCreator()
Returns the document's creator.
|
abstract String |
getCustomProperty(String key)
Returns the value of a custom property.
|
static DocumentInfo |
getDocumentInfo(InputStream inStream,
IPassword password)
Static method to get the document information from a document from an InputStream.
|
static DocumentInfo |
getDocumentInfo(String fileName,
IPassword passwords)
Static method to get the document information from a document in a file.
|
static DocumentInfo |
getDocumentInfo(URL url,
IPassword password)
Static method to get the document information from a document from a URL.
|
abstract String |
getKeywords()
Returns the document's keywords.
|
abstract Date |
getModDate()
Returns the document's modified date.
|
abstract int |
getPageCount()
Gets the number of pages in the document.
|
abstract String |
getProducer()
Returns the document's producer.
|
abstract String |
getSubject()
Returns the document's subject.
|
abstract String |
getTitle()
Gets the document's title.
|
abstract byte[] |
getXMPMetadata()
Returns the raw XMP metadata in the document as an array of bytes.
|
abstract String |
getXMPMetadata(String charsetName)
Returns the XMP metadata in the document.
|
abstract void |
setAuthor(String author)
Set the document's author.
|
abstract void |
setCreationDate(Date creationDate)
Set the document's creation date.
|
abstract void |
setCreator(String creator)
Set the document's creator.
|
abstract void |
setCustomProperty(String key,
String value)
Sets a custom application property in the document info for the document.
|
abstract void |
setKeywords(String keywords)
Set the document's keywords.
|
abstract void |
setModifiedDate(Date modDate)
Set the document's modified date.
|
abstract void |
setProducer(String producer)
Set the document's producer.
|
abstract void |
setSubject(String subject)
Set the document's subject.
|
abstract void |
setTitle(String title)
Sets the document's title.
|
abstract void |
setXMPMetadata(byte[] xmpData)
Sets the XMP metadata block in the document.
|
abstract void |
setXMPMetadata(String xmpString,
String charsetName)
Sets the XMP metadata block in the document.
|
public static final String KEY_TITLE
public static final String KEY_AUTHOR
public static final String KEY_SUBJECT
public static final String KEY_KEYWORDS
public static final String KEY_CREATOR
public static final String KEY_PRODUCER
public static final String KEY_CREATIONDATE
public static final String KEY_MODDATE
public static DocumentInfo getDocumentInfo(String fileName, IPassword passwords) throws PDFException
fileName
- The name of the file.passwords
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public static DocumentInfo getDocumentInfo(InputStream inStream, IPassword password) throws PDFException
inStream
- InputStream that will be used to read the PDF document.password
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public static DocumentInfo getDocumentInfo(URL url, IPassword password) throws PDFException
url
- The url where the PDF document can be found.password
- An object that provides passwords to open the document, leave null if not needed.
When working with documents that have no passwords, the host application should pass null for the
value of this parameter. When documents are known to have passwords, the host application should
pass an instance of the PDFPassword
class that can hold a single
password or a list of passwords.PDFException
public abstract String getTitle()
public abstract void setTitle(String title) throws PDFException
title
- The document's title.PDFException
public abstract String getAuthor()
public abstract String getSubject()
public abstract String getKeywords()
public abstract String getCreator()
public abstract String getProducer()
public abstract Date getCreationDate()
public abstract Date getModDate()
public abstract int getPageCount()
public abstract void setAuthor(String author) throws PDFException
author
- The document's author.PDFException
public abstract void setCreationDate(Date creationDate) throws PDFException
creationDate
- The document's creation date.PDFException
public abstract void setCreator(String creator) throws PDFException
creator
- The document's creator.PDFException
public abstract void setKeywords(String keywords) throws PDFException
keywords
- The document's keywords.PDFException
public abstract void setModifiedDate(Date modDate) throws PDFException
modDate
- The document's modified date.PDFException
public abstract void setProducer(String producer) throws PDFException
producer
- The document's producer.PDFException
public abstract void setSubject(String subject) throws PDFException
subject
- The document's subject.PDFException
public abstract String getXMPMetadata(String charsetName) throws UnsupportedEncodingException
charsetName
- The name of the character set to use when decoding the XMP data stream. Every implementation
of Java is supposed to support US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE and UTF-16UnsupportedEncodingException
public abstract void setXMPMetadata(String xmpString, String charsetName) throws PDFException, UnsupportedEncodingException
xmpString
- The new XMP block.charsetName
- The name of the character set to use when encoding the XMP string to bytes. Every implementation
of Java is supposed to support US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE and UTF-16PDFException
UnsupportedEncodingException
public abstract void setXMPMetadata(byte[] xmpData) throws PDFException
PDFException
public abstract byte[] getXMPMetadata()
public abstract void setCustomProperty(String key, String value) throws PDFException
key
- The property key or namevalue
- The value of the property.PDFException
public abstract String getCustomProperty(String key)
key
- The name of the property