public interface

DocumentPdfMetadata

com.pspdfkit.document.metadata.DocumentPdfMetadata

Class Overview

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.

Summary

Public Methods
abstract PdfValue get(String key)
Retrieves a single metadata value from PDF.
abstract String getAuthor()
Returns the author of the document.
abstract Date getCreationDate()
Returns the document creation date (if set).
abstract String getCreator()
Returns software used to create the document.
abstract List<String> getKeywords()
Returns document keywords.
abstract Map<StringPdfValue> getMetadata()
Returns full metadata of the document.
abstract Date getModificationDate()
Returns the date of when the document was last modified (if any).
abstract String getProducer()
Returns software library used to create the document.
abstract String getSubject()
Returns the subject of the document.
abstract String getTitle()
Returns the title given to the document.
abstract boolean hasUnsavedChanges()
Returns true if there were any changes to the PDF metadata without save.
abstract void set(String key, PdfValue value)
Sets a single value in the PDF.
abstract void setAuthor(String author)
Sets the author for the document.
abstract void setCreationDate(Date creationDate)
Sets the creation date for the document.
abstract void setCreator(String creator)
Sets the creator for the document.
abstract void setKeywords(List<String> keywords)
Sets the keywords for the document.
abstract void setModificationDate(Date modificationDate)
Sets the modification date for the document.
abstract void setProducer(String producer)
Sets the producer for the document.
abstract void setSubject(String subject)
Sets the subject for the document.
abstract void setTitle(String title)
Sets the title for the document.

Public Methods

public abstract PdfValue get (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.

public abstract String getAuthor ()

Returns the author of the document.

Returns
  • Author of the document, or null if non-existent.

public abstract Date getCreationDate ()

Returns the document creation date (if set).

Returns
  • Creation date or null if not set.

public abstract String getCreator ()

Returns software used to create the document.

Returns
  • Software used to create the document, or null if not set.

public abstract List<String> getKeywords ()

Returns document keywords.

Returns
  • Document keywords, or null if none set.

public abstract Map<StringPdfValue> getMetadata ()

Returns full metadata of the document.

Returns
  • Full metadata of the document.

public abstract Date getModificationDate ()

Returns the date of when the document was last modified (if any).

Returns
  • Modification date or null if not set.

public abstract String getProducer ()

Returns software library used to create the document.

Returns
  • Software library used to create the document, or null if not set.

public abstract String getSubject ()

Returns the subject of the document.

Returns
  • Subject of the document, or null if non-existent.

public abstract String getTitle ()

Returns the title given to the document.

Returns
  • Document title, or null of there's not title.

public 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.

public abstract void set (String key, PdfValue value)

Sets a single value in the PDF.

Parameters
key Metadata key, must not be null.
value New value or null to remove the value.

public abstract void setAuthor (String author)

Sets the author for the document.

Parameters
author Author for the document, or null to remove it.

public abstract void setCreationDate (Date creationDate)

Sets the creation date for the document.

Parameters
creationDate Creation date for the document, or null to remove it.

public abstract void setCreator (String creator)

Sets the creator for the document.

Parameters
creator Creator for the document, or null to remove it.

public abstract void setKeywords (List<String> keywords)

Sets the keywords for the document.

Parameters
keywords List of keywords for the document, or null/empty list to remove them.

public abstract void setModificationDate (Date modificationDate)

Sets the modification date for the document.

Parameters
modificationDate Modification date for the document, or null to remove it.

public abstract void setProducer (String producer)

Sets the producer for the document.

Parameters
producer Producer for the document, or null to remove it.

public abstract void setSubject (String subject)

Sets the subject for the document.

Parameters
subject Subject for the document, or null to remove it.

public abstract void setTitle (String title)

Sets the title for the document.

Parameters
title Title for the document, or null to remove it.