pdfrum-edit 0.5.0

PDF serializer: full/incremental save, page import, subsetting
Documentation
//! The dictionary keys this crate writes, added to the shared table.
//!
//! `pdfrum-object`'s `names` module owns the keys several crates share; the
//! ones below are keys only a *writer* has occasion to spell.

#[expect(unused_imports, reason = "the shared keys are re-exported as one set")]
pub(crate) use pdfrum_object::names::{
    ANNOTS, ART_BOX, ASCENT, AUTHOR, BASE_FONT, BBOX, BITS_PER_COMPONENT, BLEED_BOX, BM, BORDER, C,
    CA, CA_LOWER, CAP_HEIGHT, CID_SYSTEM_INFO, CID_TO_GID_MAP, COLOR_SPACE, COLUMNS, CONTENTS,
    COUNT, CREATOR, CROP_BOX, DA, DCT_DECODE, DECODE, DECODE_PARMS, DESCENDANT_FONTS, DESCENT,
    DESTS, ENCODING, ENCRYPT, EXT_G_STATE, F, FILTER, FIRST, FIRST_CHAR, FLAGS, FLATE_DECODE, FONT,
    FONT_BBOX, FONT_DESCRIPTOR, FONT_FILE, FONT_FILE2, FONT_FILE3, FORM, FORM_TYPE, FT, HEIGHT, IC,
    ID, IMAGE, IMAGE_MASK, INDEX, INFO, INK_LIST, ITALIC_ANGLE, JPX_DECODE, KEYWORDS, KIDS,
    LAST_CHAR, LENGTH, M, MATRIX, MEDIA_BOX, METADATA, N, NAMES, NM, NORMAL, ORDERING, P, PAGE,
    PAGES, PARENT, PREV, PROPERTIES, Q, QUAD_POINTS, R, RECT, RESOURCES, ROOT, ROTATE, S, SIZE,
    SMASK, STANDARD, STEM_V, SUBJECT, SUBTYPE, T, TITLE, TO_UNICODE, TRIM_BOX, TRUE_TYPE, TYPE,
    TYPE1, VIEWER_PREFERENCES, W, WIDTH, WIDTHS, WIN_ANSI_ENCODING, XML, XOBJECT, XREF, XREF_STM,
};

pdfrum_object::names! {
    // ---- Catalog and page tree, writer side (tables 28, 29) ----

    /// The document catalog's own `/Type` value (`/Catalog`).
    CATALOG = "Catalog";

    // ---- Outline items (table 153) ----

    /// The next item at this outline level (`/Next`).
    NEXT = "Next";
    /// The last child of an outline item (`/Last`).
    LAST = "Last";
    /// An outline item's or link's destination (`/Dest`).
    DEST = "Dest";
    /// The catalog's outline tree root (`/Outlines`).
    OUTLINES = "Outlines";

    // ---- Image XObjects (table 89) ----

    /// Whether a DCT stream's components were transformed
    /// (`/ColorTransform`).
    COLOR_TRANSFORM = "ColorTransform";
    /// One grey component per sample (`/DeviceGray`).
    DEVICE_GRAY = "DeviceGray";
    /// Three additive components per sample (`/DeviceRGB`).
    DEVICE_RGB = "DeviceRGB";
    /// Four subtractive components per sample (`/DeviceCMYK`).
    DEVICE_CMYK = "DeviceCMYK";

    // ---- Fonts and subsetting (tables 111, 117, 120, 122) ----

    /// The descriptor's own name for the font (`/FontName`).
    FONT_NAME = "FontName";
    /// Length of an uncompressed TrueType program (`/Length1`).
    LENGTH1 = "Length1";
    /// The identity-mapping horizontal CMap (`/Identity-H`).
    IDENTITY_H = "Identity-H";
    /// A Type 0 (composite) font's `/Subtype` value (`/Type0`).
    TYPE0 = "Type0";
    /// A CIDFont with CFF glyphs (`/CIDFontType0`).
    CID_FONT_TYPE0 = "CIDFontType0";
    /// A CIDFont with TrueType glyphs (`/CIDFontType2`).
    CID_FONT_TYPE2 = "CIDFontType2";
    /// An OpenType-wrapped program (`/OpenType`).
    OPEN_TYPE = "OpenType";
    /// The CMap's own type, always 2 for a ToUnicode map (`/CMapType`).
    CMAP_TYPE = "CMapType";
    /// Registry name inside `/CIDSystemInfo` (`/Registry`).
    REGISTRY = "Registry";
    /// Supplement number inside `/CIDSystemInfo` (`/Supplement`).
    SUPPLEMENT = "Supplement";
    /// Encrypted portion of a Type 1 program (`/Length2`).
    LENGTH2 = "Length2";
    /// Trailer portion of a Type 1 program (`/Length3`).
    LENGTH3 = "Length3";

    // ---- Annotations (ISO 32000-1 §12.5) ----

    /// An annotation dictionary's `/Type` value (`/Annot`).
    ANNOT = "Annot";
    /// Border style dictionary (`/BS`).
    BS = "BS";
    /// Icon name for a text annotation (`/Name`).
    NAME = "Name";
    /// Whether a text annotation's pop-up starts open (`/Open`).
    OPEN = "Open";
    /// Comment icon name (`/Comment`).
    COMMENT = "Comment";
    /// Action dictionary (`/A`), e.g. a URI action on a Link.
    A = "A";
    /// Uniform resource identifier (`/URI`).
    URI = "URI";
    /// Line endpoints (`/L`) for a Line annotation.
    L = "L";
    /// Line ending styles (`/LE`).
    LE = "LE";

    /// Unicode file specification string (`/UF`).
    UF = "UF";

    /// File specification dictionary type (`/Filespec`).
    FILESPEC = "Filespec";
    /// Destination on an action (`/D`).
    D = "D";
    /// GoTo action subtype (`/GoTo`).
    GO_TO = "GoTo";
    /// Remote go-to action subtype (`/GoToR`).
    GO_TO_R = "GoToR";
    /// Launch an application / document (`/Launch`).
    LAUNCH = "Launch";
    /// Open the destination in a new window (`/NewWindow`).
    NEW_WINDOW = "NewWindow";
    /// Fit the whole page in the window (`/Fit`).
    FIT = "Fit";
    /// Fit the page width (`/FitH`).
    FIT_H = "FitH";
    /// Fit the page height (`/FitV`).
    FIT_V = "FitV";
    /// Fit a rectangle (`/FitR`).
    FIT_R = "FitR";
    /// Fit the page bounding box (`/FitB`).
    FIT_B = "FitB";
    /// Fit the bounding-box width (`/FitBH`).
    FIT_BH = "FitBH";
    /// Fit the bounding-box height (`/FitBV`).
    FIT_BV = "FitBV";
    /// XYZ destination mode (`/XYZ`).
    XYZ = "XYZ";

    // ---- Interactive forms, writer side (tables 218, 220, 226-230) ----

    /// The root field array on `/AcroForm` (`/Fields`).
    FIELDS = "Fields";
    /// The form's default resource dictionary (`/DR`).
    DR = "DR";
    /// A widget annotation's subtype (`/Widget`).
    WIDGET = "Widget";
    /// A text field's `/FT` value (`/Tx`).
    TX = "Tx";
    /// A button field's `/FT` value (`/Btn`).
    BTN = "Btn";
    /// A choice field's `/FT` value (`/Ch`).
    CH = "Ch";
    /// The state a toggle shows when it is clear (`/Off`).
    OFF = "Off";
    /// The longest value a text field accepts (`/MaxLen`).
    MAX_LEN = "MaxLen";
    /// A choice field's options (`/Opt`).
    OPT = "Opt";
    /// A field's default value, restored by a reset action (`/DV`).
    DV = "DV";
    // ---- Catalog navigation and labelling (tables 28, 159) ----

    /// The action a reader runs when the document opens (`/OpenAction`).
    OPEN_ACTION = "OpenAction";
    /// A number tree's leaf array (`/Nums`).
    NUMS = "Nums";
    /// The number the first page of a label range takes (`/St`).
    ST = "St";
    // Subtype spellings (/Highlight, /Text, …) come from
    // `pdfrum_doc::Subtype::as_bytes` at write time — do not duplicate them here.
}