class PDF::Document
- PDF::Document
- Reference
- Object
Overview
A canonical PDF file initially consists of four elements :
- A one-line header identifying the version number of the PDF specification to which the file conforms
- A body containing the objects that make up the document contained in the file
- A cross-reference table containing information about the indirect objects in the file
- A trailer giving the location of the cross-reference table and of certain special objects within the body of the file
The body of a PDF file consists of a sequence of indirect objects representing the contents of a document. The objects, which are of the basic types described in Section 3.2, “Objects,” represent components of the document such as fonts, pages, and sampled images.
in the code we should pretain the document structure, not the actual text te output. the real form will be generated at render time
Defined in:
pdf/document/crossref.crpdf/document/document.cr
pdf/document/encrypt.cr
pdf/document/header.cr
pdf/document/trailer.cr
Constant Summary
-
EOF =
"%%EOF"
Constructors
Instance Method Summary
- #crossrefs(ids : Hash(Object, Int32)) : CrossRef
-
#render_to_pdf(io : IO)
Outputing a pdf into bytes is easier than reading it.
Constructor Detail
def self.new(header : PDF::Document::Header, body : PDF::Catalog, crossrefs, trailers : PDF::Document::Trailer)
#
Instance Method Detail
Outputing a pdf into bytes is easier than reading it. We needn't support all pdf formats,but just our subset to use.
writing a pdf is really fast,because it's just flatten objects into some bytes.
- output header。
- remove all unuesed objects
- renumber objects from 1 to n
- output objects from number 1, counting each obj in the crossref
- output crossref
- output trailer, and trailer dictionary
- output EOF