class PDF::Document::Trailer

Overview

The trailer of a PDF file enables an application reading the file to quickly find the cross-reference table and certain special objects. Applications should read a PDF file from its end. The last line of the file contains only the end-of-file marker, %%EOF. (See implementation note 15 in Appendix H.) The two preceding lines contain the keyword startxref and the byte offset from the beginning of the file to the beginning of the xref keyword in the last cross-reference section. The startxref line is preceded by the trailer dictionary, consisting of the keyword trailer followed by a series of key-value pairs enclosed in double angle brackets. Thus the trailer has the following overall structure:

trailer
 << key1 value1
    key2 value2 …
    keyn valuen
 >>
startxref
Byte_offset_of_last_cross-reference_section
%%EOF

Here is a factual trailer:

trailer
<< /Size 22
 /Root 2 0 R
 /Info 1 0 R
 /ID [ <81b14aafa313db63dbd6f981e49f94f4>
<81b14aafa313db63dbd6f981e49f94f4>
]
>>
startxref
18799
%%EOF

Included Modules

Defined in:

pdf/document/trailer.cr

Instance Method Summary

Instance methods inherited from module PDF::Renderable

render_to_pdf(io : IO) : IO render_to_pdf

Instance Method Detail

def render_to_pdf(io : IO) : IO #

TODO


[View source]
def size #

The total number of entries in the file’s cross-reference table, as defined by the combination of the original section and all update sections. Equivalently, this value is 1 greater than the highest object number used in the file.


[View source]