def cast_object(reference, type) #:nodoc:
            @revisions.each do |rev|
                if rev.body.include?(reference)
                    object = rev.body[reference]
                    return object if object.is_a?(type)

                    if type < rev.body[reference].class
                        rev.body[reference] = object.cast_to(type, @parser)

                        return rev.body[reference]
                    end
                end
            end

            nil
        end
def cast_object(reference, type) #:nodoc:
            @revisions.each do |rev|
                if rev.body.include?(reference)
                    object = rev.body[reference]
                    return object if object.is_a?(type)

                    if type < rev.body[reference].class
                        rev.body[reference] = object.cast_to(type, @parser)

                        return rev.body[reference]
                    end
                end
            end

            nil
        end
Casts a PDF object into another object type.
 The target type must be a subtype of the original type.