PDF Character Constants (helpers/chars.ts)

LibPDF-js/core · src/helpers/chars.ts · typescript · MIT
files, dev-tools, lang:typescript, tag:constants

Defines byte constants and sets for parsing PDF syntax according to specifications. Use this when building PDF parsers or document processing utilities.

// Source: https://github.com/LibPDF-js/core | License: MIT | Copyright 2026 Lucas Smith
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * PDF character constants (PDF spec 7.2.2)
 *
 * Reusable byte values and sets for parsing PDF syntax.
 */

// Line endings
export const LF = 0x0a; // Line Feed
export const CR = 0x0d; // Carriage Return

// Common whitespace
export const SPACE = 0x20; // Space
export const TAB = 0x09; // Tab
export const NUL = 0x00; // Null
export const FF = 0x0c; // Form Feed
export const BS = 0x08; // Backspace

/**
 * PDF whitespace characters (PDF spec 7.2.2)
 *
 * NUL, TAB, LF, FF, CR, SPACE
 */
export const WHITESPACE = new Set([NUL, TAB, LF, FF, CR, SPACE]);

// Delimiters
export const CHAR_PARENTHESIS_OPEN = 0x28; // (
export const CHAR_PARE

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key