Package org.apache.pdfbox.pdmodel.common
Class PDMetadata
java.lang.Object
org.apache.pdfbox.pdmodel.common.PDStream
org.apache.pdfbox.pdmodel.common.PDMetadata
- All Implemented Interfaces:
COSObjectable
This class represents metadata for various objects in a PDF document.
- Version:
- $Revision: 1.3 $
- Author:
- Ben Litchfield
-
Constructor Summary
ConstructorsConstructorDescriptionPDMetadata
(COSStream str) Constructor.PDMetadata
(PDDocument document) This will create a new PDMetadata object.PDMetadata
(PDDocument doc, InputStream str, boolean filtered) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.jempbox.xmp.XMPMetadata
Deprecated.will return an InputStream in the future.void
importXMPMetadata
(byte[] xmp) Import an XMP stream into the PDF document.void
importXMPMetadata
(org.apache.jempbox.xmp.XMPMetadata xmp) Deprecated.Methods inherited from class org.apache.pdfbox.pdmodel.common.PDStream
addCompression, createFromCOS, createInputStream, createOutputStream, getByteArray, getCOSObject, getDecodedStreamLength, getDecodeParms, getFile, getFileDecodeParams, getFileFilters, getFilters, getInputStreamAsString, getLength, getMetadata, getPartiallyFilteredStream, getStream, setDecodedStreamLength, setDecodeParms, setFile, setFileDecodeParams, setFileFilters, setFilters, setMetadata
-
Constructor Details
-
PDMetadata
This will create a new PDMetadata object.- Parameters:
document
- The document that the stream will be part of.
-
PDMetadata
Constructor. Reads all data from the input stream and embeds it into the document, this will close the InputStream.- Parameters:
doc
- The document that will hold the stream.str
- The stream parameter.filtered
- True if the stream already has a filter applied.- Throws:
IOException
- If there is an error creating the stream in the document.
-
PDMetadata
Constructor.- Parameters:
str
- The stream parameter.
-
-
Method Details
-
exportXMPMetadata
Deprecated.will return an InputStream in the future.Extract the XMP metadata and create and build an in memory object. To persist changes back to the PDF you must call importXMPMetadata.- Returns:
- A parsed XMP object.
- Throws:
IOException
- If there is an error parsing the XMP data.
-
importXMPMetadata
Import an XMP stream into the PDF document.- Parameters:
xmp
- The XMP data.- Throws:
IOException
- If there is an error generating the XML document.
-
importXMPMetadata
@Deprecated public void importXMPMetadata(org.apache.jempbox.xmp.XMPMetadata xmp) throws IOException, TransformerException Deprecated.Import an XMP stream into the PDF document.- Parameters:
xmp
- The XMP data.- Throws:
IOException
- If there is an error generating the XML document.TransformerException
- If there is an error generating the XML document.
-