Module: Pdfrb::PdfConstants
- Defined in:
- lib/pdfrb/pdf_constants.rb
Overview
PDF lexical and structural constants. Sourced from ISO 32000-2:2020 subclause 7.2 ("Lexical Conventions"). These are the bytes and tokens the Tokenizer operates on.
Constant Summary collapse
- HEADER_PREFIX =
The header magic every PDF file begins with (after optional BOM or leading whitespace, which the spec discourages but tolerates).
"%PDF-"- BINARY_MARKER =
Binary-marketing comment recommended after the header so tools that sniff for binary content treat the file correctly.
"%\xE2\xE3\xCF\xD3".b
- EOF_MARKER =
End-of-file marker (technically just a comment, but conventional).
"%%EOF"- WHITESPACE =
Whitespace bytes per s7.2.2. NUL, TAB, LF, FF, CR, SPACE.
"\x00\t\n\f\r ".b
- DELIMITERS =
Delimiter bytes per s7.2.2.
"()<>[]{}/%".b
- TERMINATORS =
Bytes that terminate a name token, a number, or a keyword.
(WHITESPACE + DELIMITERS).b
- PDF_VERSIONS =
PDF versions Pdfrb recognises, sorted oldest to newest. The Arlington model defines the canonical version set; this is its Ruby mirror.
%w[1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 2.0].freeze
- LATEST_VERSION =
Latest PDF version Pdfrb fully understands. Versions newer than this raise UnsupportedVersionError on read.
"2.0"- KEYWORDS =
PDF "object" grammar keywords the Tokenizer treats specially.
%w[ obj endobj stream endstream xref startxref trailer true false null ].freeze