def xrefs
            raise InvalidObjectError, "Cannot find xrefs to a direct object" unless self.indirect?
            raise InvalidObjectError, "Not attached to any document" if self.document.nil?

            @document.each_object(compressed: true)
                     .flat_map { |object|
                        case object
                        when Stream
                            object.dictionary.xref_cache[self.reference]
                        when ObjectCache
                            object.xref_cache[self.reference]
                        end
                     }
                     .compact!
        end
def xrefs
            raise InvalidObjectError, "Cannot find xrefs to a direct object" unless self.indirect?
            raise InvalidObjectError, "Not attached to any document" if self.document.nil?

            @document.each_object(compressed: true)
                     .flat_map { |object|
                        case object
                        when Stream
                            object.dictionary.xref_cache[self.reference]
                        when ObjectCache
                            object.xref_cache[self.reference]
                        end
                     }
                     .compact!
        end
Returns an array of references pointing to the current object.