Interface DocumentPdfMetadata
-
- All Implemented Interfaces:
public interface DocumentPdfMetadata
This class allows you to modify a PDF documents metadata.
Metadata is defined in two ways in the PDF spec (§ 14.3): - The Info PDF dictionary. This class is handling this. - A metadata stream containing XMP data. See DocumentXmpMetadata for that.
Use getPdfMetadata to retrieve an instance of this class.
-
-
Method Summary
Modifier and Type Method Description abstract String
getTitle()
Returns the title given to the document. abstract void
setTitle(@Nullable() String title)
Sets the title for the document. abstract String
getAuthor()
Returns the author of the document. abstract void
setAuthor(@Nullable() String author)
Sets the author for the document. abstract String
getSubject()
Returns the subject of the document. abstract void
setSubject(@Nullable() String subject)
Sets the subject for the document. abstract List<String>
getKeywords()
Returns document keywords. abstract void
setKeywords(@Nullable() List<String> keywords)
Sets the keywords for the document. abstract String
getCreator()
Returns software used to create the document. abstract void
setCreator(@Nullable() String creator)
Sets the creator for the document. abstract String
getProducer()
Returns software library used to create the document. abstract void
setProducer(@Nullable() String producer)
Sets the producer for the document. abstract Date
getCreationDate()
Returns the document creation date (if set). abstract void
setCreationDate(@Nullable() Date creationDate)
Sets the creation date for the document. abstract Date
getModificationDate()
Returns the date of when the document was last modified (if any). abstract void
setModificationDate(@Nullable() Date modificationDate)
Sets the modification date for the document. abstract Map<String, PdfValue>
getMetadata()
Returns full metadata of the document. abstract PdfValue
get(@NonNull() String key)
Retrieves a single metadata value from PDF. abstract void
set(@NonNull() String key, @Nullable() PdfValue value)
Sets a single value in the PDF. abstract boolean
hasUnsavedChanges()
Returns true
if there were any changes to the PDF metadata without save.-
-
Method Detail
-
getTitle
@Nullable() abstract String getTitle()
Returns the title given to the document.
- Returns:
Document title, or
null
of there's not title.
-
setTitle
abstract void setTitle(@Nullable() String title)
Sets the title for the document.
- Parameters:
title
- Title for the document, ornull
to remove it.
-
getAuthor
@Nullable() abstract String getAuthor()
Returns the author of the document.
- Returns:
Author of the document, or
null
if non-existent.
-
setAuthor
abstract void setAuthor(@Nullable() String author)
Sets the author for the document.
- Parameters:
author
- Author for the document, ornull
to remove it.
-
getSubject
@Nullable() abstract String getSubject()
Returns the subject of the document.
- Returns:
Subject of the document, or
null
if non-existent.
-
setSubject
abstract void setSubject(@Nullable() String subject)
Sets the subject for the document.
- Parameters:
subject
- Subject for the document, ornull
to remove it.
-
getKeywords
@Nullable() abstract List<String> getKeywords()
Returns document keywords.
- Returns:
Document keywords, or
null
if none set.
-
setKeywords
abstract void setKeywords(@Nullable() List<String> keywords)
Sets the keywords for the document.
- Parameters:
keywords
- List of keywords for the document, ornull
/empty list to remove them.
-
getCreator
@Nullable() abstract String getCreator()
Returns software used to create the document.
- Returns:
Software used to create the document, or
null
if not set.
-
setCreator
abstract void setCreator(@Nullable() String creator)
Sets the creator for the document.
- Parameters:
creator
- Creator for the document, ornull
to remove it.
-
getProducer
@Nullable() abstract String getProducer()
Returns software library used to create the document.
- Returns:
Software library used to create the document, or
null
if not set.
-
setProducer
abstract void setProducer(@Nullable() String producer)
Sets the producer for the document.
- Parameters:
producer
- Producer for the document, ornull
to remove it.
-
getCreationDate
@Nullable() abstract Date getCreationDate()
Returns the document creation date (if set).
- Returns:
Creation date or
null
if not set.
-
setCreationDate
abstract void setCreationDate(@Nullable() Date creationDate)
Sets the creation date for the document.
- Parameters:
creationDate
- Creation date for the document, ornull
to remove it.
-
getModificationDate
@Nullable() abstract Date getModificationDate()
Returns the date of when the document was last modified (if any).
- Returns:
Modification date or
null
if not set.
-
setModificationDate
abstract void setModificationDate(@Nullable() Date modificationDate)
Sets the modification date for the document.
- Parameters:
modificationDate
- Modification date for the document, ornull
to remove it.
-
getMetadata
@NonNull() abstract Map<String, PdfValue> getMetadata()
Returns full metadata of the document.
- Returns:
Full metadata of the document.
-
get
@Nullable() abstract PdfValue get(@NonNull() String key)
Retrieves a single metadata value from PDF.
- Parameters:
key
- Metadata key, must not be null.- Returns:
a PdfValue instance representing a value or
null
.
-
set
abstract void set(@NonNull() String key, @Nullable() PdfValue value)
Sets a single value in the PDF.
- Parameters:
key
- Metadata key, must not be null.value
- New value ornull
to remove the value.
-
hasUnsavedChanges
abstract boolean hasUnsavedChanges()
Returns
true
if there were any changes to the PDF metadata without save.- Returns:
true
if PDF metadata was changed,false
otherwise.
-
-
-
-