Package com.itextpdf.kernel.pdf
Class PdfObjectWrapper<T extends PdfObject>
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<T>
-
- Direct Known Subclasses:
AbstractPdfFormField
,AbstractPdfFunction
,PdfAcroForm
,PdfAction
,PdfAnnotation
,PdfAnnotationAdditionalActions
,PdfAnnotationAppearance
,PdfAnnotationBorder
,PdfCatalog
,PdfCollection
,PdfCollectionField
,PdfCollectionItem
,PdfCollectionSchema
,PdfCollectionSort
,PdfColorSpace
,PdfDate
,PdfDestination
,PdfEncryptedPayload
,PdfEncryptedPayloadDocument
,PdfEncryption
,PdfExtGState
,PdfFileSpec
,PdfFixedPrint
,PdfFont
,PdfLayer
,PdfLayerMembership
,PdfMcr
,PdfMediaClipData
,PdfNamespace
,PdfOCProperties
,PdfOutputIntent
,PdfPage
,PdfPages
,PdfPattern
,PdfRendition
,PdfResources
,PdfShading
,PdfSigFieldLock
,PdfSignature
,PdfSignatureApp
,PdfSignatureBuildProperties
,PdfStructElem
,PdfStructTreeRoot
,PdfStructureAttributes
,PdfTarget
,PdfTransparencyGroup
,PdfUserProperty
,PdfViewerPreferences
,PdfVisibilityExpression
,PdfWin
,PdfXObject
public abstract class PdfObjectWrapper<T extends PdfObject> extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PdfObjectWrapper(T pdfObject)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static void
ensureObjectIsAddedToDocument(PdfObject object)
Some wrappers use object's indirect reference to obtain thePdfDocument
to which the object belongs to.protected void
ensureUnderlyingObjectHasIndirectReference()
void
flush()
T
getPdfObject()
boolean
isFlushed()
protected abstract boolean
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.PdfObjectWrapper<T>
makeIndirect(PdfDocument document)
Marks object behind wrapper to be saved as indirect.PdfObjectWrapper<T>
makeIndirect(PdfDocument document, PdfIndirectReference reference)
Marks object behind wrapper to be saved as indirect.protected static void
markObjectAsIndirect(PdfObject pdfObject)
protected void
setForbidRelease()
PdfObjectWrapper<T>
setModified()
protected void
setPdfObject(T pdfObject)
protected void
unsetForbidRelease()
-
-
-
Constructor Detail
-
PdfObjectWrapper
protected PdfObjectWrapper(T pdfObject)
-
-
Method Detail
-
getPdfObject
public T getPdfObject()
-
makeIndirect
public PdfObjectWrapper<T> makeIndirect(PdfDocument document, PdfIndirectReference reference)
Marks object behind wrapper to be saved as indirect.- Parameters:
document
- a document the indirect reference belongs to.reference
- a reference which will be assigned for the object behind wrapper.- Returns:
- object itself.
-
makeIndirect
public PdfObjectWrapper<T> makeIndirect(PdfDocument document)
Marks object behind wrapper to be saved as indirect.- Parameters:
document
- a document the indirect reference will belong to.- Returns:
- object itself.
-
setModified
public PdfObjectWrapper<T> setModified()
-
flush
public void flush()
-
isFlushed
public boolean isFlushed()
-
isWrappedObjectMustBeIndirect
protected abstract boolean isWrappedObjectMustBeIndirect()
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.- Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-
setPdfObject
protected void setPdfObject(T pdfObject)
-
setForbidRelease
protected void setForbidRelease()
-
unsetForbidRelease
protected void unsetForbidRelease()
-
ensureUnderlyingObjectHasIndirectReference
protected void ensureUnderlyingObjectHasIndirectReference()
-
markObjectAsIndirect
protected static void markObjectAsIndirect(PdfObject pdfObject)
-
ensureObjectIsAddedToDocument
protected static void ensureObjectIsAddedToDocument(PdfObject object)
Some wrappers use object's indirect reference to obtain thePdfDocument
to which the object belongs to. For this matter, for these wrappers it is implicitly defined that they work with indirect objects only. Commonly these wrappers have two constructors: one withPdfDocument
as parameter to create a new object, and the other one which wraps around the givenPdfObject
. This method should be used in the second type of constructors to ensure that wrapper will able to obtain thePdfDocument
instance.- Parameters:
object
- thePdfObject
to be checked if it is indirect.
-
-