Package org.apache.pdfbox.multipdf
Class PDFCloneUtility
java.lang.Object
org.apache.pdfbox.multipdf.PDFCloneUtility
Utility class used to clone PDF objects. It keeps track of objects it has already cloned.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PDDocumentprivate static final org.apache.commons.logging.Log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPDFCloneUtility(PDDocument dest) Creates a new instance for the given target document. -
Method Summary
Modifier and TypeMethodDescriptionprivate COSArraycloneCOSArray(COSArray array) private COSBaseprivate COSDictionarycloneCOSDictionary(COSDictionary dictionary) private COSStreamcloneCOSStream(COSStream stream) <TCOSBase extends COSBase>
TCOSBasecloneForNewDocument(TCOSBase base) Deep-clones the given object for inclusion into a different PDF document identified by the destination parameter.(package private) voidcloneMerge(COSObjectable base, COSObjectable target) Merges two objects of the same type by deep-cloning its members.private voidcloneMergeCOSBase(COSBase source, COSBase target) (package private) PDDocumentReturns the destination PDF document this cloner instance is set up for.private booleanhasSelfReference(COSBase parent, COSBase value) Check whether an element (of an array or a dictionary) points to its parent.
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
destination
-
clonedVersion
-
clonedValues
-
-
Constructor Details
-
PDFCloneUtility
Creates a new instance for the given target document.- Parameters:
dest- the destination PDF document that will receive the clones
-
-
Method Details
-
getDestination
PDDocument getDestination()Returns the destination PDF document this cloner instance is set up for.- Returns:
- the destination PDF document
-
cloneForNewDocument
Deep-clones the given object for inclusion into a different PDF document identified by the destination parameter. Expert use only, don’t use it if you don’t know exactly what you are doing.- Parameters:
base- the initial object as the root of the deep-clone operation- Returns:
- the cloned instance of the base object
- Throws:
IOException- if an I/O error occurs
-
cloneCOSBaseForNewDocument
- Throws:
IOException
-
cloneCOSArray
- Throws:
IOException
-
cloneCOSStream
- Throws:
IOException
-
cloneCOSDictionary
- Throws:
IOException
-
cloneMerge
Merges two objects of the same type by deep-cloning its members.
Base and target must be instances of the same class.- Parameters:
base- the base object to be clonedtarget- the merge target- Throws:
IOException- if an I/O error occurs
-
cloneMergeCOSBase
- Throws:
IOException
-
hasSelfReference
Check whether an element (of an array or a dictionary) points to its parent.- Parameters:
parent- COSArray or COSDictionaryvalue- an element
-