def import_object_from_document(object)
            obj_doc = object.document

            # Remove the previous instance if the object is indirect to avoid duplicates.
            if obj_doc.equal?(@document)
                @document.delete_object(object.reference) if object.indirect?

            # Otherwise, create a exported version of the object.
            else
                object = object.export
            end

            object
        end
def import_object_from_document(object)
            obj_doc = object.document

            # Remove the previous instance if the object is indirect to avoid duplicates.
            if obj_doc.equal?(@document)
                @document.delete_object(object.reference) if object.indirect?

            # Otherwise, create a exported version of the object.
            else
                object = object.export
            end

            object
        end
Preprocess the object in case it already belongs to a document.
 If the document is the same as the current object stream, remove the duplicate object from our document.
 If the object comes from another document, use the export method to create a version without references.