Class: PDF::Reader::XRef

Class | PDF::Reader::XRef
In: | lib/pdf/reader/xref.rb
Parent: | Object

An internal PDF::Reader class that represents the Xref table in a PDF file An Xref table is a map of object identifiers and byte offsets. Any time a particular object needs to be found, the Xref table is used to find where it is stored in the file.

### Methods

load load_xref_table new obj_type object offset_for pdf_version store stream?

### Public Class methods

new(buffer)

create a new Xref table based on the contents of the supplied PDF::Reader::Buffer object

### Public Instance methods

load(offset = nil)

Read the xref table from the underlying buffer. If offset is specified the table will be loaded from there, otherwise the default offset will be located and used.

Will fail silently if there is no xref table at the requested offset.

load_xref_table()

Assumes the underlying buffer is positioned at the start of an Xref table and processes it into memory.

obj_type(ref)

returns the type of object a ref points to

object(ref, save_pos = true)

Return a string containing the contents of an entire PDF object. The object is requested by specifying a PDF::Reader::Reference object that contains the objects ID and revision number

If the object is a stream, that is returned as well

offset_for(ref)

returns the byte offset for the specified PDF object.

ref - a PDF::Reader::Reference object containing an object ID and revision number

pdf_version()

returns the PDF version of the current document. Technically this isn‘t part of the XRef table, but it is one of the lowest level data items in the file, so we‘ve lumped it in with the cross reference code.

store(id, gen, offset)

Stores an offset value for a particular PDF object ID and revision number

stream?(ref)

returns true if the supplied references points to an object with a stream

[Validate]