Package com.itextpdf.text.xml.xmp
Class XmpWriter
java.lang.Object
com.itextpdf.text.xml.xmp.XmpWriter
- Direct Known Subclasses:
PdfAXmpWriter
With this class you can create an Xmp Stream that can be used for adding
Metadata to a PDF Dictionary. Remark that this class doesn't cover the
complete XMP specification.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OutputStream
protected SerializeOptions
static final String
A possible charset for the XMP.static final String
A possible charset for the XMP.static final String
A possible charset for the XMP.static final String
A possible charset for the XMP.protected XMPMeta
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an XmpWriter.XmpWriter
(OutputStream os, PdfDictionary info) XmpWriter
(OutputStream os, String utfEncoding, int extraSpace) Creates an XmpWriter.XmpWriter
(OutputStream os, Map<String, String> info) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDocInfoProperty
(Object key, String value) void
Deprecated.void
addRdfDescription
(String xmlns, String content) Deprecated.void
appendAlternateArrayItem
(String schemaNS, String arrayName, String value) Simplifies the construction of an alternate array by not requiring that you pre-create an empty array.void
appendArrayItem
(String schemaNS, String arrayName, String value) Simplifies the construction of an array by not requiring that you pre-create an empty array.void
appendOrderedArrayItem
(String schemaNS, String arrayName, String value) Simplifies the construction of an ordered array by not requiring that you pre-create an empty array.void
close()
Flushes and closes the XmpWriter.void
serialize
(OutputStream externalOutputStream) Flushes and closes the XmpWriter.void
void
setProperty
(String schemaNS, String propName, Object value) void
Sets the XMP to read-only
-
Field Details
-
UTF8
A possible charset for the XMP.- See Also:
-
UTF16
A possible charset for the XMP.- See Also:
-
UTF16BE
A possible charset for the XMP.- See Also:
-
UTF16LE
A possible charset for the XMP.- See Also:
-
xmpMeta
-
outputStream
-
serializeOptions
-
-
Constructor Details
-
XmpWriter
Creates an XmpWriter.- Parameters:
os
-utfEncoding
-extraSpace
-- Throws:
IOException
-
XmpWriter
Creates an XmpWriter.- Parameters:
os
-- Throws:
IOException
-
XmpWriter
- Parameters:
os
-info
-- Throws:
IOException
-
XmpWriter
- Parameters:
os
-info
-- Throws:
IOException
- Since:
- 5.0.1 (generic type in signature)
-
-
Method Details
-
getXmpMeta
-
setReadOnly
public void setReadOnly()Sets the XMP to read-only -
setAbout
- Parameters:
about
- The about to set.
-
addRdfDescription
Deprecated.Adds an rdf:Description.- Parameters:
xmlns
-content
-- Throws:
IOException
-
addRdfDescription
Deprecated.Adds an rdf:Description.- Parameters:
s
-- Throws:
IOException
-
setProperty
- Parameters:
schemaNS
- The namespace URI for the property. Has the same usage as in getProperty.propName
- The name of the property. Has the same usage as ingetProperty()
.value
- the value for the property (only leaf properties have a value). Arrays and non-leaf levels of structs do not have values. Must benull
if the value is not relevant.
The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and byte[] are handled, on all othertoString()
is called.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.
-
appendArrayItem
Simplifies the construction of an array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.- Parameters:
schemaNS
- The namespace URI for the array.arrayName
- The name of the array. May be a general path expression, must not be null or the empty string.value
- the value of the array item.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.
-
appendOrderedArrayItem
public void appendOrderedArrayItem(String schemaNS, String arrayName, String value) throws XMPException Simplifies the construction of an ordered array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.- Parameters:
schemaNS
- The namespace URI for the array.arrayName
- The name of the array. May be a general path expression, must not be null or the empty string.value
- the value of the array item.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.
-
appendAlternateArrayItem
public void appendAlternateArrayItem(String schemaNS, String arrayName, String value) throws XMPException Simplifies the construction of an alternate array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.- Parameters:
schemaNS
- The namespace URI for the array.arrayName
- The name of the array. May be a general path expression, must not be null or the empty string.value
- the value of the array item.- Throws:
XMPException
- Wraps all errors and exceptions that may occur.
-
serialize
Flushes and closes the XmpWriter.- Throws:
IOException
XMPException
-
close
Flushes and closes the XmpWriter.- Throws:
IOException
-
addDocInfoProperty
- Throws:
XMPException
-