Package com.itextpdf.kernel.pdf.tagging
Class PdfNamespace
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.pdf.tagging.PdfNamespace
A wrapper for namespace dictionaries (ISO 32000-2 section 14.7.4). A namespace dictionary defines a namespace within the structure tree.
This pdf entity is meaningful only for the PDF documents of version 2.0 and higher.
-
Constructor Summary
ConstructorDescriptionPdfNamespace
(PdfDictionary dictionary) Constructs namespace from the givenPdfDictionary
that represents namespace dictionary.PdfNamespace
(PdfString namespaceName) Constructs a namespace defined by the given namespace name.PdfNamespace
(String namespaceName) Constructs a namespace defined by the given namespace name. -
Method Summary
Modifier and TypeMethodDescriptionaddNamespaceRoleMapping
(String thisNsRole, String defaultNsRole) Adds to the namespace role map (seesetNamespaceRoleMap(PdfDictionary)
) a single role mapping to the default standard structure namespace.addNamespaceRoleMapping
(String thisNsRole, String targetNsRole, PdfNamespace targetNs) Adds to the namespace role map (seesetNamespaceRoleMap(PdfDictionary)
) a single role mapping to the target namespace.Gets the string defining the namespace name.A dictionary that maps the names of structure types used in the namespace to their approximate equivalents in another namespace.Gets file specification identifying the schema file, which defines this namespace.protected boolean
Defines if the object behind this wrapper must be an indirect object in the resultant document.setNamespaceName
(PdfString namespaceName) Sets the string defining the namespace name.setNamespaceName
(String namespaceName) Sets the string defining the namespace name.setNamespaceRoleMap
(PdfDictionary roleMapNs) A dictionary that maps the names of structure types used in the namespace to their approximate equivalents in another namespace.setSchema
(PdfFileSpec fileSpec) Sets file specification identifying the schema file, which defines this namespace.Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, flush, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Constructor Details
-
PdfNamespace
Constructs namespace from the givenPdfDictionary
that represents namespace dictionary. This method is useful for property reading in reading mode or modifying in stamping mode.- Parameters:
-
dictionary
- aPdfDictionary
that represents namespace in the document.
-
PdfNamespace
Constructs a namespace defined by the given namespace name.- Parameters:
-
namespaceName
- aString
defining the namespace name (conventionally a uniform resource identifier, or URI).
-
PdfNamespace
Constructs a namespace defined by the given namespace name.- Parameters:
-
namespaceName
- aPdfString
defining the namespace name (conventionally a uniform resource identifier, or URI).
-
-
Method Details
-
setNamespaceName
Sets the string defining the namespace name.- Parameters:
-
namespaceName
- aString
defining the namespace name (conventionally a uniform resource identifier, or URI). - Returns:
-
this
PdfNamespace
instance.
-
setNamespaceName
Sets the string defining the namespace name.- Parameters:
-
namespaceName
- aPdfString
defining the namespace name (conventionally a uniform resource identifier, or URI). - Returns:
-
this
PdfNamespace
instance.
-
getNamespaceName
Gets the string defining the namespace name.- Returns:
-
a
String
defining the namespace name (conventionally a uniform resource identifier, or URI).
-
setSchema
Sets file specification identifying the schema file, which defines this namespace.- Parameters:
-
fileSpec
- aPdfFileSpec
identifying the schema file. - Returns:
-
this
PdfNamespace
instance.
-
getSchema
Gets file specification identifying the schema file, which defines this namespace.- Returns:
-
a
PdfFileSpec
identifying the schema file.
-
setNamespaceRoleMap
A dictionary that maps the names of structure types used in the namespace to their approximate equivalents in another namespace.- Parameters:
-
roleMapNs
- aPdfDictionary
which is comprised of a set of keys representing structure element types in the namespace defined within this namespace dictionary. The corresponding value for each of these keys shall either be a singlePdfName
identifying a structure element type in the default namespace or anPdfArray
where the first value shall be a structure element type name in a target namespace with the second value being an indirect reference to the target namespace dictionary. - Returns:
-
this
PdfNamespace
instance.
-
getNamespaceRoleMap
A dictionary that maps the names of structure types used in the namespace to their approximate equivalents in another namespace.- Returns:
-
a
PdfDictionary
which is comprised of a set of keys representing structure element types in the namespace defined within this namespace dictionary. The corresponding value for each of these keys shall either be a singlePdfName
identifying a structure element type in the default namespace or anPdfArray
where the first value shall be a structure element type name in a target namespace with the second value being an indirect reference to the target namespace dictionary.
-
addNamespaceRoleMapping
Adds to the namespace role map (seesetNamespaceRoleMap(PdfDictionary)
) a single role mapping to the default standard structure namespace.- Parameters:
-
thisNsRole
- aString
identifying structure element type in this namespace. -
defaultNsRole
- aString
identifying a structure element type in the default standard structure namespace. - Returns:
-
this
PdfNamespace
instance.
-
addNamespaceRoleMapping
public PdfNamespace addNamespaceRoleMapping(String thisNsRole, String targetNsRole, PdfNamespace targetNs) Adds to the namespace role map (seesetNamespaceRoleMap(PdfDictionary)
) a single role mapping to the target namespace.- Parameters:
-
thisNsRole
- aString
identifying structure element type in this namespace. -
targetNsRole
- aString
identifying a structure element type in the target namespace. -
targetNs
- aPdfNamespace
identifying the target namespace. - Returns:
-
this
PdfNamespace
instance.
-
isWrappedObjectMustBeIndirect
protected boolean isWrappedObjectMustBeIndirect()Description copied from class:PdfObjectWrapper
Defines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.- Specified by:
-
isWrappedObjectMustBeIndirect
in classPdfObjectWrapper<PdfDictionary>
- Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-