Sign in

    pdflite

    Byte-oriented PDF reading, writing, and manipulation toolkit for MoonBit.

    pdf
    document
    parser
    writer
    Download zip
    Version
    0.3.3
    License
    Apache-2.0
    Last updated
    9 days ago
    Downloads
    4K

    #pdflite

    moonbitlang/pdflite is a byte-oriented PDF toolkit for MoonBit. The root package exposes the public document model, object parser/writer, page tree helpers, content operators, text extraction, filters, images, fonts, encryption, and high-level read/write entry points.

    flowchart LR Bytes[PDF bytes] --> Reader[pdf_read_document_from_bytes] Reader --> Document[PdfDocument] Document --> Pages[page tree and resources] Document --> Objects[object table] Pages --> Content[content operators] Objects --> Writer[pdf_write_document] Content --> Writer Writer --> BytesOut[PDF bytes]

    Use this package when callers need a complete in-memory PDF document. Use the subpackages for narrower concerns such as byte primitives, transforms, Flate, dates, low-level cryptography, async file IO, or Markdown extraction.

    #Native CLI

    The native and Wasm CLI wrapper lives in cmd/pdflite and uses moonbitlang/core/argparse for help, version text, subcommands, and parse errors. Run it from this module with moon run:

    moon run --target native cmd/pdflite -- info fixtures/camlpdf/logo.pdf moon run --target native cmd/pdflite -- info --json fixtures/camlpdf/logo.pdf moon run --target native cmd/pdflite -- validate fixtures/camlpdf/logo.pdf moon run --target native cmd/pdflite -- rewrite fixtures/camlpdf/logo.pdf _build/logo-roundtrip.pdf moon run --target native cmd/pdflite -- merge _build/combined.pdf cover.pdf chapter-1.pdf appendix.pdf

    Black-box CLI documentation tests live in tests/cram. The cram file invokes the binary directly, so build it once and point PDFLITE_CLI at the executable. Moon Cram is currently available in MoonBit nightly, so run them with a nightly toolchain:

    moon run --target native --release --build-only cmd/pdflite PDFLITE_CLI="$PWD/_build/native/release/build/moonbitlang/pdflite/cmd/pdflite/pdflite.exe" \ PDFLITE_LOGO_PDF="$PWD/fixtures/camlpdf/logo.pdf" \ moon cram test --shell /bin/bash --timeout-seconds 120 tests/cram

    #Release checks

    Normal CI runs the package tests and native/Wasm CLI checks. From the workspace root, run focused checks when changing the PDF engine:

    moon check pdflite moon test --target native pdflite moon test --target wasm pdflite

    Publish from the pdflite/ module directory with moon publish; the tool checks the packaged module before publishing. Use moon publish --dry-run for a preflight without publishing a version. See the workspace release process for module ordering and credentials.

    #What This Package Owns

    • The public PdfDocument representation and its object table.
    • PDF syntax objects such as arrays, dictionaries, streams, names, strings, numbers, booleans, nulls, and indirect references.
    • Readers for headers, trailers, classic xref tables, xref streams, object streams, damaged-startxref reconstruction, revisions, and encrypted inputs.
    • Writers for classic xref tables, xref streams, compressed xref streams, generated trailer IDs, incremental updates, and encrypted outputs.
    • Page-tree construction, page queries, resource renumbering, merge/extract helpers, bookmarks, destinations, annotations, optional content groups, and content stream operators.
    • Text/font/image helpers that need the full document graph.

    #Pedantic Boundaries

    • PDF byte data stays byte-oriented. @core.PdfBytes is Bytes; @core.PdfName and PdfString store raw bytes until an explicit text-decoding API is used.
    • Object numbers are one-based in normal document allocation. Missing or deferred objects are represented explicitly instead of being guessed.
    • Public parsing and writing APIs raise @core.PdfError for typed failure classes. Tests should assert concrete errors where the input class is stable.
    • Methods that mutate a document mutate the in-memory object table directly. Functional wrapper APIs, when present, copy before mutation.
    • Encryption APIs distinguish authentication, object crypt filters, saved encryption state, denied permissions, and recryption paths.

    #Checked Examples

    Create a minimum valid document, serialize it, and read it back:

    ///|
    test "minimum document round trip" {
    let document = try! @pdflite.pdf_minimum_valid_pdf()
    let bytes = try! @pdflite.pdf_write_document(document)
    let version = try! @reader.pdf_read_header_from_bytes(bytes)
    if version.major != 1 || version.minor != 0 {
    fail("expected a PDF 1.0 header")
    }
    let parsed = try! @pdflite.pdf_read_document_from_bytes(bytes)
    inspect(try! parsed.endpage(), content="1")
    }

    Write byte-preserving PDF names. Names are bytes, not MoonBit Unicode strings:

    ///|
    test "name writer escapes delimiter bytes" {
    let name = @core.pdf_name_of_bytes(
    try! @core.pdf_bytes_of_int_array([47, 65, 32, 66]),
    )
    @test.assert_eq(@core.pdf_int_array_of_bytes(@pdflite.pdf_write_name(name)), [
    47, 65, 35, 50, 48, 66,
    ])
    }

    #Package Notes

    • PdfDocument owns the object table, root catalog pointer, trailer dictionary, encryption state, and revision metadata.
    • @syntax.PdfObject values preserve PDF syntax-level objects, including byte strings, names, dictionaries, streams, and indirect references.
    • Read APIs raise @core.PdfError for malformed input rather than silently repairing data. Reconstruction helpers are explicit APIs.
    • Writer APIs can emit classic xref tables, xref streams, compressed xref streams, generated trailer IDs, incremental updates, and encrypted output.

    #Verification Notes

    • README.mbt.md blocks are blackbox tests for the root package.
    • Most root tests should run on all MoonBit targets. Native-only random or file behavior belongs in targeted test files or the async_io package.
    • For public API changes, run moon info and review pkg.generated.mbti.
    • For behavior changes, run moon test; for native reader/writer coverage, also run native-target tests.

    PdfAddTextFontSource

    pub(all) enum PdfAddTextFontSource {
    PdfAddTextPreMadeFontPack(PdfFontPack)
    PdfAddTextExistingNamedFont
    } derive(Eq, ToJson,
    Debug
    )

    Font source options for cpdf add-text.

    This ports the source-level non-embedding Cpdfembed.cpdffont variants. TrueType EmbedInfo remains a separate embedding slice.

    PdfAddTextFontSource::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfAddTextFontSource::equal(PdfAddTextFontSource, PdfAddTextFontSource) -> Bool

    PdfAddTextFontSource::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfAddTextFontSource::not_equal(x : PdfAddTextFontSource, y : PdfAddTextFontSource) -> Bool

    PdfAddTextFontSource::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfAddTextFontSource::to_json(PdfAddTextFontSource) -> Json

    PdfAddTextFontSource::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfAddTextFontSource::to_repr(PdfAddTextFontSource) ->
    Repr

    PdfBookmarkNode

    type PdfBookmarkNode derive(Eq, ToJson,
    Debug
    )

    PdfBookmarkNode::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfBookmarkNode::equal(PdfBookmarkNode, PdfBookmarkNode) -> Bool

    PdfBookmarkNode::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfBookmarkNode::not_equal(x : PdfBookmarkNode, y : PdfBookmarkNode) -> Bool

    PdfBookmarkNode::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfBookmarkNode::to_json(PdfBookmarkNode) -> Json

    PdfBookmarkNode::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfBookmarkNode::to_repr(PdfBookmarkNode) ->
    Repr

    PdfCIDKeyedFont

    pub(all) struct PdfCIDKeyedFont {
    basefont :
    PdfName

    composite : PdfCompositeCIDFont
    encoding : PdfCMapEncoding
    } derive(Eq, ToJson,
    Debug
    )

    Parsed Type 0 font with descendant CIDFont and CMap encoding.

    PdfCIDKeyedFont::debug_name

    fn PdfCIDKeyedFont::debug_name(self : PdfCIDKeyedFont) -> String

    Return a compact debug label containing the Type 0 base font name.

    PdfCIDKeyedFont::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDKeyedFont::equal(PdfCIDKeyedFont, PdfCIDKeyedFont) -> Bool

    PdfCIDKeyedFont::is_identity_h

    fn PdfCIDKeyedFont::is_identity_h(self : PdfCIDKeyedFont) -> Bool

    Test whether this Type 0 font uses /Identity-H.

    PdfCIDKeyedFont::is_identity_v

    fn PdfCIDKeyedFont::is_identity_v(self : PdfCIDKeyedFont) -> Bool

    Test whether this Type 0 font uses /Identity-V.

    PdfCIDKeyedFont::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDKeyedFont::not_equal(x : PdfCIDKeyedFont, y : PdfCIDKeyedFont) -> Bool

    PdfCIDKeyedFont::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDKeyedFont::to_json(PdfCIDKeyedFont) -> Json

    PdfCIDKeyedFont::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDKeyedFont::to_repr(PdfCIDKeyedFont) ->
    Repr

    PdfCIDKeyedFont::uses_two_byte_codes

    fn PdfCIDKeyedFont::uses_two_byte_codes(self : PdfCIDKeyedFont) -> Bool

    Return true when this Type 0 font uses fixed two-byte character codes.

    PdfCIDSystemInfo

    pub(all) struct PdfCIDSystemInfo {
    registry : Bytes
    ordering : Bytes
    supplement : Int
    } derive(Eq, ToJson,
    Debug
    )

    CID-system identity from a CIDFont or CMap dictionary.

    registry and ordering are stored as PDF bytes because PDF strings are byte sequences, not MoonBit String values.

    PdfCIDSystemInfo::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDSystemInfo::equal(PdfCIDSystemInfo, PdfCIDSystemInfo) -> Bool

    PdfCIDSystemInfo::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDSystemInfo::not_equal(x : PdfCIDSystemInfo, y : PdfCIDSystemInfo) -> Bool

    PdfCIDSystemInfo::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDSystemInfo::to_json(PdfCIDSystemInfo) -> Json

    PdfCIDSystemInfo::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDSystemInfo::to_repr(PdfCIDSystemInfo) ->
    Repr

    PdfCIDVerticalWidth

    pub(all) struct PdfCIDVerticalWidth {
    width : Double
    vx : Double
    vy : Double
    } derive(Eq, ToJson,
    Debug
    )

    Vertical metrics for a CID in a composite font.

    The fields correspond to the PDF /W2 tuple: vertical width and horizontal displacement vector components.

    PdfCIDVerticalWidth::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDVerticalWidth::equal(PdfCIDVerticalWidth, PdfCIDVerticalWidth) -> Bool

    PdfCIDVerticalWidth::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDVerticalWidth::not_equal(x : PdfCIDVerticalWidth, y : PdfCIDVerticalWidth) -> Bool

    PdfCIDVerticalWidth::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDVerticalWidth::to_json(PdfCIDVerticalWidth) -> Json

    PdfCIDVerticalWidth::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCIDVerticalWidth::to_repr(PdfCIDVerticalWidth) ->
    Repr

    PdfCMapCodeSpace

    pub(all) struct PdfCMapCodeSpace {
    length : Int
    first : Int
    last : Int
    } derive(Eq, ToJson,
    Debug
    )

    One parsed CMap code-space range.

    length is the character-code byte length, and first/last are the inclusive packed-byte bounds accepted by that range.

    PdfCMapCodeSpace::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapCodeSpace::equal(PdfCMapCodeSpace, PdfCMapCodeSpace) -> Bool

    PdfCMapCodeSpace::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapCodeSpace::not_equal(x : PdfCMapCodeSpace, y : PdfCMapCodeSpace) -> Bool

    PdfCMapCodeSpace::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapCodeSpace::to_json(PdfCMapCodeSpace) -> Json

    PdfCMapCodeSpace::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapCodeSpace::to_repr(PdfCMapCodeSpace) ->
    Repr

    PdfCMapEncoding

    pub(all) enum PdfCMapEncoding {
    PdfPredefinedCMap(
    PdfName
    )
    PdfCMap(Int)
    PdfExternalCMap(Int, PdfParsedCMap)
    } derive(Eq, ToJson,
    Debug
    )

    CMap source used by a Type 0 font.

    A CMap may be predefined by name, referenced as an external stream object, or parsed from that external stream together with its mapping tables.

    PdfCMapEncoding::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapEncoding::equal(PdfCMapEncoding, PdfCMapEncoding) -> Bool

    PdfCMapEncoding::is_identity_h

    fn PdfCMapEncoding::is_identity_h(self : PdfCMapEncoding) -> Bool

    Test whether this CMap encoding is the predefined /Identity-H map.

    PdfCMapEncoding::is_identity_v

    fn PdfCMapEncoding::is_identity_v(self : PdfCMapEncoding) -> Bool

    Test whether this CMap encoding is the predefined /Identity-V map.

    PdfCMapEncoding::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapEncoding::not_equal(x : PdfCMapEncoding, y : PdfCMapEncoding) -> Bool

    PdfCMapEncoding::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapEncoding::to_json(PdfCMapEncoding) -> Json

    PdfCMapEncoding::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCMapEncoding::to_repr(PdfCMapEncoding) ->
    Repr

    PdfCMapEncoding::uses_two_byte_codes

    fn PdfCMapEncoding::uses_two_byte_codes(self : PdfCMapEncoding) -> Bool

    Return true when this CMap consumes text as fixed two-byte character codes.

    Identity CMaps and common UCS2/UTF16 predefined maps are treated as two-byte. Parsed external CMaps are two-byte only when all code spaces have length 2, or when they inherit an identity base with no explicit spaces.

    PdfCalculatorFunction

    pub(all) struct PdfCalculatorFunction {
    operations : Array[PdfCalculatorOp]
    } derive(Eq, ToJson,
    Debug
    )

    PDF function type 4, represented as parsed calculator operations.

    Evaluation starts with the function inputs on the stack and returns the numeric values left on the stack after all operations have run.

    PdfCalculatorFunction::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorFunction::equal(PdfCalculatorFunction, PdfCalculatorFunction) -> Bool

    PdfCalculatorFunction::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorFunction::not_equal(x : PdfCalculatorFunction, y : PdfCalculatorFunction) -> Bool

    PdfCalculatorFunction::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorFunction::to_json(PdfCalculatorFunction) -> Json

    PdfCalculatorFunction::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorFunction::to_repr(PdfCalculatorFunction) ->
    Repr

    PdfCalculatorOp

    pub(all) enum PdfCalculatorOp {
    PdfCalculatorInt(Int)
    PdfCalculatorFloat(Double)
    PdfCalculatorAbs
    PdfCalculatorAdd
    PdfCalculatorAnd
    PdfCalculatorAtan
    PdfCalculatorBitshift
    PdfCalculatorBool(Bool)
    PdfCalculatorCeiling
    PdfCalculatorCos
    PdfCalculatorCopy
    PdfCalculatorCvi
    PdfCalculatorCvr
    PdfCalculatorSub
    PdfCalculatorMul
    PdfCalculatorDiv
    PdfCalculatorDup
    PdfCalculatorExch
    PdfCalculatorExp
    PdfCalculatorFloor
    PdfCalculatorIdiv
    PdfCalculatorIf(Array[PdfCalculatorOp])
    PdfCalculatorIfElse(Array[PdfCalculatorOp], Array[PdfCalculatorOp])
    PdfCalculatorIndex
    PdfCalculatorLn
    PdfCalculatorLog
    PdfCalculatorEq
    PdfCalculatorGe
    PdfCalculatorGt
    PdfCalculatorLe
    PdfCalculatorLt
    PdfCalculatorMod
    PdfCalculatorNe
    PdfCalculatorNeg
    PdfCalculatorNot
    PdfCalculatorOr
    PdfCalculatorPop
    PdfCalculatorRoll
    PdfCalculatorRound
    PdfCalculatorSin
    PdfCalculatorSqrt
    PdfCalculatorTruncate
    PdfCalculatorXor
    } derive(Eq, ToJson,
    Debug
    )

    Operation in a PDF type 4 PostScript calculator function.

    Literals push values onto the calculator stack. PdfCalculatorIf and PdfCalculatorIfElse store nested procedure bodies; the remaining variants correspond to PDF calculator-language operators.

    PdfCalculatorOp::debug_name

    fn PdfCalculatorOp::debug_name(self : PdfCalculatorOp) -> String

    Return the calculator-language spelling for one operation.

    Procedure operations are formatted recursively in the same brace-delimited form accepted by the type 4 parser.

    PdfCalculatorOp::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorOp::equal(PdfCalculatorOp, PdfCalculatorOp) -> Bool

    PdfCalculatorOp::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorOp::not_equal(x : PdfCalculatorOp, y : PdfCalculatorOp) -> Bool

    PdfCalculatorOp::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorOp::to_json(PdfCalculatorOp) -> Json

    PdfCalculatorOp::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCalculatorOp::to_repr(PdfCalculatorOp) ->
    Repr

    PdfClipContour

    pub(all) struct PdfClipContour {
    hole : Bool
    vertices : Array[PdfClipVertex]
    } derive(Eq, ToJson,
    Debug
    )

    One contour in a cpdf/GPC polygon.

    hole=true matches cpdf's 1 hole flag. hole=false matches cpdf's 0 exterior-contour flag.

    PdfClipContour::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipContour::equal(PdfClipContour, PdfClipContour) -> Bool

    PdfClipContour::hole_flag

    fn PdfClipContour::hole_flag(self : PdfClipContour) -> Int

    Return cpdf's integer hole flag for this contour.

    PdfClipContour::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipContour::not_equal(x : PdfClipContour, y : PdfClipContour) -> Bool

    PdfClipContour::num_vertices

    fn PdfClipContour::num_vertices(self : PdfClipContour) -> Int

    Number of vertices in this contour.

    PdfClipContour::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipContour::to_json(PdfClipContour) -> Json

    PdfClipContour::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipContour::to_repr(PdfClipContour) ->
    Repr

    PdfClipOperation

    pub(all) enum PdfClipOperation {
    PdfClipDifference
    PdfClipIntersection
    PdfClipExclusiveOr
    PdfClipUnion
    } derive(Eq, ToJson,
    Debug
    )

    Boolean polygon operation used by cpdf's GPC-backed clipping helpers.

    PdfClipOperation::clip_polygons

    Clip subject by clip using this cpdf/GPC operation.

    PdfClipOperation::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipOperation::equal(PdfClipOperation, PdfClipOperation) -> Bool

    PdfClipOperation::gpc_code

    fn PdfClipOperation::gpc_code(self : PdfClipOperation) -> Int

    Return the integer operation code used by cpdf's GPC binding.

    PdfClipOperation::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipOperation::not_equal(x : PdfClipOperation, y : PdfClipOperation) -> Bool

    PdfClipOperation::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipOperation::to_json(PdfClipOperation) -> Json

    PdfClipOperation::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipOperation::to_repr(PdfClipOperation) ->
    Repr

    PdfClipPolygon

    pub(all) struct PdfClipPolygon {
    contours : Array[PdfClipContour]
    } derive(Eq, ToJson,
    Debug
    )

    A cpdf/GPC polygon represented as an ordered list of contours.

    PdfClipPolygon::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipPolygon::equal(PdfClipPolygon, PdfClipPolygon) -> Bool

    PdfClipPolygon::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipPolygon::not_equal(x : PdfClipPolygon, y : PdfClipPolygon) -> Bool

    PdfClipPolygon::num_contours

    fn PdfClipPolygon::num_contours(self : PdfClipPolygon) -> Int

    Number of contours in this polygon.

    PdfClipPolygon::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipPolygon::to_json(PdfClipPolygon) -> Json

    PdfClipPolygon::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipPolygon::to_repr(PdfClipPolygon) ->
    Repr

    PdfClipVertex

    pub(all) struct PdfClipVertex {
    x : Double
    y : Double
    } derive(Eq, ToJson,
    Debug
    )

    A vertex in a cpdf/GPC polygon contour.

    PdfClipVertex::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipVertex::equal(PdfClipVertex, PdfClipVertex) -> Bool

    PdfClipVertex::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipVertex::not_equal(x : PdfClipVertex, y : PdfClipVertex) -> Bool

    PdfClipVertex::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipVertex::to_json(PdfClipVertex) -> Json

    PdfClipVertex::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfClipVertex::to_repr(PdfClipVertex) ->
    Repr

    PdfColourSpace

    Parsed representation of the PDF colour spaces supported by this package.

    Device spaces represent the PDF built-ins. Calibrated and ICC-based spaces preserve their calibration data, indexed spaces hold an expanded lookup table, and separation or DeviceN spaces retain their tint transform objects for round-tripping.

    PdfColourSpace::content_json

    fn PdfColourSpace::content_json(self : PdfColourSpace) -> Json

    Return cpdfcontent's JSON colour-space name.

    PdfColourSpace::debug_name

    fn PdfColourSpace::debug_name(self : PdfColourSpace) -> String

    Return a diagnostic name for a colour space.

    Built-in spaces use their PDF names. Composite spaces include the diagnostic name of their alternate or base space, making the result useful for logs, snapshots, and error messages rather than for serialization.

    PdfColourSpace::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfColourSpace::equal(PdfColourSpace, PdfColourSpace) -> Bool

    PdfColourSpace::name

    Return the PDF colourant name carried by a separation space.

    Only PdfSeparation has a single associated colourant name in this API. Other colour spaces, including PdfDeviceN, return None.

    PdfColourSpace::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfColourSpace::not_equal(x : PdfColourSpace, y : PdfColourSpace) -> Bool

    PdfColourSpace::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfColourSpace::to_json(PdfColourSpace) -> Json

    PdfColourSpace::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfColourSpace::to_repr(PdfColourSpace) ->
    Repr

    PdfCompositeCIDFont

    pub(all) struct PdfCompositeCIDFont {
    cid_system_info : PdfCIDSystemInfo
    cid_basefont :
    PdfName

    cid_fontdescriptor : PdfFontDescriptor
    cid_widths : Array[(Int, Double)]
    cid_widths2 : Array[(Int, PdfCIDVerticalWidth)]
    cid_default_width : Double
    cid_default_width2 : Array[Double]
    } derive(Eq, ToJson,
    Debug
    )

    Parsed descendant CIDFont data for a Type 0 composite font.

    Width arrays are normalized into explicit CID-to-width entries while preserving the PDF default horizontal and vertical widths.

    PdfCompositeCIDFont::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCompositeCIDFont::equal(PdfCompositeCIDFont, PdfCompositeCIDFont) -> Bool

    PdfCompositeCIDFont::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCompositeCIDFont::not_equal(x : PdfCompositeCIDFont, y : PdfCompositeCIDFont) -> Bool

    PdfCompositeCIDFont::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCompositeCIDFont::to_json(PdfCompositeCIDFont) -> Json

    PdfCompositeCIDFont::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfCompositeCIDFont::to_repr(PdfCompositeCIDFont) ->
    Repr

    PdfContentAxialShading

    pub(all) struct PdfContentAxialShading {
    axialshading_coords : (Double, Double, Double, Double)
    axialshading_domain : (Double, Double)
    axialshading_function : Array[PdfFunction]
    axialshading_extend : (Bool, Bool)
    } derive(Eq, ToJson,
    Debug
    )

    Axial shading dictionary data.

    PdfContentAxialShading::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentAxialShading::equal(PdfContentAxialShading, PdfContentAxialShading) -> Bool

    PdfContentAxialShading::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentAxialShading::not_equal(x : PdfContentAxialShading, y : PdfContentAxialShading) -> Bool

    PdfContentAxialShading::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentAxialShading::to_json(PdfContentAxialShading) -> Json

    PdfContentAxialShading::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentAxialShading::to_repr(PdfContentAxialShading) ->
    Repr

    PdfContentBoundingBox

    pub(all) struct PdfContentBoundingBox {
    x0 : Double
    y0 : Double
    x1 : Double
    y1 : Double
    x2 : Double
    y2 : Double
    x3 : Double
    y3 : Double
    } derive(Eq, ToJson,
    Debug
    )

    Eight-point cpdfcontent bounding box quad.

    PdfContentBoundingBox::content_json

    Return cpdfcontent's eight-number bbox array.

    PdfContentBoundingBox::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentBoundingBox::equal(PdfContentBoundingBox, PdfContentBoundingBox) -> Bool

    PdfContentBoundingBox::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentBoundingBox::not_equal(x : PdfContentBoundingBox, y : PdfContentBoundingBox) -> Bool

    PdfContentBoundingBox::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentBoundingBox::to_json(PdfContentBoundingBox) -> Json

    PdfContentBoundingBox::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentBoundingBox::to_repr(PdfContentBoundingBox) ->
    Repr

    PdfContentClippingState

    pub(all) struct PdfContentClippingState {
    clipping_path : Array[
    PdfPath
    ]
    } derive(Eq, ToJson,
    Debug
    )

    Clipping-only state exported for inline images, images, and shadings.

    PdfContentClippingState::content_json

    Return cpdfcontent's JSON shape for clipping-only state.

    PdfContentClippingState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentClippingState::equal(PdfContentClippingState, PdfContentClippingState) -> Bool

    PdfContentClippingState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentClippingState::not_equal(x : PdfContentClippingState, y : PdfContentClippingState) -> Bool

    PdfContentClippingState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentClippingState::to_json(PdfContentClippingState) -> Json

    PdfContentClippingState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentClippingState::to_repr(PdfContentClippingState) ->
    Repr

    PdfContentColourValues

    pub(all) enum PdfContentColourValues {
    PdfContentColourFloats(Array[Double])
    PdfContentColourNamed(String, Array[Double])
    PdfContentColourPattern
    } derive(Eq, ToJson,
    Debug
    )

    Colour operands carried by cpdfcontent's path drawing state.

    PdfContentColourValues::content_json

    Return cpdfcontent's JSON shape for colour operands.

    PdfContentColourValues::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentColourValues::equal(PdfContentColourValues, PdfContentColourValues) -> Bool

    PdfContentColourValues::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentColourValues::not_equal(x : PdfContentColourValues, y : PdfContentColourValues) -> Bool

    PdfContentColourValues::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentColourValues::to_json(PdfContentColourValues) -> Json

    PdfContentColourValues::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentColourValues::to_repr(PdfContentColourValues) ->
    Repr

    PdfContentDashPattern

    pub(all) struct PdfContentDashPattern {
    array : Array[Double]
    phase : Double
    } derive(Eq, ToJson,
    Debug
    )

    Dash pattern carried by cpdfcontent's path drawing state.

    PdfContentDashPattern::content_json

    Return cpdfcontent's JSON shape for a path dash pattern.

    PdfContentDashPattern::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentDashPattern::equal(PdfContentDashPattern, PdfContentDashPattern) -> Bool

    PdfContentDashPattern::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentDashPattern::not_equal(x : PdfContentDashPattern, y : PdfContentDashPattern) -> Bool

    PdfContentDashPattern::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentDashPattern::to_json(PdfContentDashPattern) -> Json

    PdfContentDashPattern::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentDashPattern::to_repr(PdfContentDashPattern) ->
    Repr

    PdfContentFunctionShading

    pub(all) struct PdfContentFunctionShading {
    funshading_domain : (Double, Double, Double, Double)
    funshading_matrix :
    TransformMatrix

    funshading_function : PdfFunction
    } derive(Eq, ToJson,
    Debug
    )

    Function-based shading dictionary data.

    PdfContentFunctionShading::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentFunctionShading::equal(PdfContentFunctionShading, PdfContentFunctionShading) -> Bool

    PdfContentFunctionShading::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentFunctionShading::not_equal(x : PdfContentFunctionShading, y : PdfContentFunctionShading) -> Bool

    PdfContentFunctionShading::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentFunctionShading::to_json(PdfContentFunctionShading) -> Json

    PdfContentFunctionShading::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentFunctionShading::to_repr(PdfContentFunctionShading) ->
    Repr

    PdfContentGlyphState

    pub(all) struct PdfContentGlyphState {
    rendering_mode : Int
    knockout : Bool
    font : String
    font_size : Double
    clipping_path : Array[
    PdfPath
    ]
    } derive(Eq, ToJson,
    Debug
    )

    Text state fields exported alongside glyph content objects.

    PdfContentGlyphState::content_json

    fn PdfContentGlyphState::content_json(self : PdfContentGlyphState) -> Json

    Return cpdfcontent's JSON shape for glyph state.

    PdfContentGlyphState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentGlyphState::equal(PdfContentGlyphState, PdfContentGlyphState) -> Bool

    PdfContentGlyphState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentGlyphState::not_equal(x : PdfContentGlyphState, y : PdfContentGlyphState) -> Bool

    PdfContentGlyphState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentGlyphState::to_json(PdfContentGlyphState) -> Json

    PdfContentGlyphState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentGlyphState::to_repr(PdfContentGlyphState) ->
    Repr

    PdfContentInlineTextFilter

    type PdfContentInlineTextFilter derive(Eq,
    Debug
    )

    PdfContentInlineTextFilter::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentInlineTextFilter::equal(PdfContentInlineTextFilter, PdfContentInlineTextFilter) -> Bool

    PdfContentInlineTextFilter::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentInlineTextFilter::not_equal(x : PdfContentInlineTextFilter, y : PdfContentInlineTextFilter) -> Bool

    PdfContentInlineTextFilter::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentInlineTextFilter::to_repr(PdfContentInlineTextFilter) ->
    Repr

    PdfContentJsonEntry

    pub(all) struct PdfContentJsonEntry {
    object : PdfContentObject
    state : PdfContentState
    bounding_box : PdfContentBoundingBox
    } derive(Eq, ToJson,
    Debug
    )

    One item in cpdfcontent's JSON content list.

    PdfContentJsonEntry::content_json

    fn PdfContentJsonEntry::content_json(self : PdfContentJsonEntry) -> Json

    Return cpdfcontent's JSON shape for one content-list entry.

    PdfContentJsonEntry::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentJsonEntry::equal(PdfContentJsonEntry, PdfContentJsonEntry) -> Bool

    PdfContentJsonEntry::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentJsonEntry::not_equal(x : PdfContentJsonEntry, y : PdfContentJsonEntry) -> Bool

    PdfContentJsonEntry::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentJsonEntry::to_json(PdfContentJsonEntry) -> Json

    PdfContentJsonEntry::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentJsonEntry::to_repr(PdfContentJsonEntry) ->
    Repr

    PdfContentLexeme

    type PdfContentLexeme derive(Eq, ToJson,
    Debug
    )

    PdfContentLexeme::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentLexeme::equal(PdfContentLexeme, PdfContentLexeme) -> Bool

    PdfContentLexeme::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentLexeme::not_equal(x : PdfContentLexeme, y : PdfContentLexeme) -> Bool

    PdfContentLexeme::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentLexeme::to_json(PdfContentLexeme) -> Json

    PdfContentLexeme::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentLexeme::to_repr(PdfContentLexeme) ->
    Repr

    PdfContentMarkedContent

    pub(all) struct PdfContentMarkedContent {
    tag : String
    properties :
    PdfObject
    ?
    } derive(Eq, ToJson,
    Debug
    )

    Active marked-content scope captured from BMC, BDC, MP, and DP operators.

    PdfContentMarkedContent::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentMarkedContent::equal(PdfContentMarkedContent, PdfContentMarkedContent) -> Bool

    PdfContentMarkedContent::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentMarkedContent::not_equal(x : PdfContentMarkedContent, y : PdfContentMarkedContent) -> Bool

    PdfContentMarkedContent::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentMarkedContent::to_json(PdfContentMarkedContent) -> Json

    PdfContentMarkedContent::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentMarkedContent::to_repr(PdfContentMarkedContent) ->
    Repr

    PdfContentObject

    pub(all) enum PdfContentObject {
    PdfContentGlyphObject(Int, String, String)
    PdfContentInlineImageObject
    PdfContentImageObject(String)
    PdfContentPathObject(
    PdfDrawnPath
    )
    PdfContentShadingObject(String)
    } derive(Eq, ToJson,
    Debug
    )

    Content objects emitted by cpdfcontent's JSON exporter.

    PdfContentObject::content_json

    fn PdfContentObject::content_json(self : PdfContentObject) -> Json

    Return cpdfcontent's JSON shape for a content object.

    PdfContentObject::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentObject::equal(PdfContentObject, PdfContentObject) -> Bool

    PdfContentObject::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentObject::not_equal(x : PdfContentObject, y : PdfContentObject) -> Bool

    PdfContentObject::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentObject::to_json(PdfContentObject) -> Json

    PdfContentObject::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentObject::to_repr(PdfContentObject) ->
    Repr

    PdfContentOperatorFrame

    pub(all) struct PdfContentOperatorFrame {
    ctm :
    TransformMatrix

    partial_path :
    PdfContentPartialPath

    clipping_path : Array[
    PdfPath
    ]
    path :
    PdfDrawnPath

    path_state : PdfContentPathState
    text_state : PdfContentTextState
    miter_limit : Double
    flatness : Double
    alpha_constant_stroke : Double
    alpha_constant_non_stroke : Double
    alpha_source : Bool
    smoothness : Double
    stroke_adjustment : Bool
    overprint_stroke : Bool
    overprint_non_stroke : Bool
    overprint_mode : Int
    black_generation :
    PdfObject

    undercolour_removal :
    PdfObject

    transfer :
    PdfObject

    halftone :
    PdfObject

    blend_mode :
    PdfObject

    soft_mask :
    PdfObject

    black_point_compensation : String
    marked_content_point : PdfContentMarkedContent?
    marked_content : Array[PdfContentMarkedContent]
    type3_d0 : PdfContentType3D0?
    type3_d1 : PdfContentType3D1?
    } derive(Eq, ToJson,
    Debug
    )

    Saved graphics/text interpreter frame pushed by PDF q/Q graphics-state operators while walking a content stream.

    PdfContentOperatorFrame::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorFrame::equal(PdfContentOperatorFrame, PdfContentOperatorFrame) -> Bool

    PdfContentOperatorFrame::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorFrame::not_equal(x : PdfContentOperatorFrame, y : PdfContentOperatorFrame) -> Bool

    PdfContentOperatorFrame::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorFrame::to_json(PdfContentOperatorFrame) -> Json

    PdfContentOperatorFrame::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorFrame::to_repr(PdfContentOperatorFrame) ->
    Repr

    PdfContentOperatorResourceResult

    pub(all) struct PdfContentOperatorResourceResult {
    state : PdfContentOperatorState
    entries : Array[PdfContentJsonEntry]
    } derive(Eq, ToJson,
    Debug
    )

    Result of applying an operator that can emit resource or graphics-state JSON entries while updating interpreter state.

    PdfContentOperatorResourceResult::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorResourceResult::equal(PdfContentOperatorResourceResult, PdfContentOperatorResourceResult) -> Bool

    PdfContentOperatorResourceResult::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorResourceResult::not_equal(x : PdfContentOperatorResourceResult, y : PdfContentOperatorResourceResult) -> Bool

    PdfContentOperatorResourceResult::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorResourceResult::to_json(PdfContentOperatorResourceResult) -> Json

    PdfContentOperatorResourceResult::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorResourceResult::to_repr(PdfContentOperatorResourceResult) ->
    Repr

    PdfContentOperatorState

    pub(all) struct PdfContentOperatorState {
    ctm :
    TransformMatrix

    partial_path :
    PdfContentPartialPath

    clipping_path : Array[
    PdfPath
    ]
    path :
    PdfDrawnPath

    path_state : PdfContentPathState
    text_state : PdfContentTextState
    miter_limit : Double
    flatness : Double
    alpha_constant_stroke : Double
    alpha_constant_non_stroke : Double
    alpha_source : Bool
    smoothness : Double
    stroke_adjustment : Bool
    overprint_stroke : Bool
    overprint_non_stroke : Bool
    overprint_mode : Int
    black_generation :
    PdfObject

    undercolour_removal :
    PdfObject

    transfer :
    PdfObject

    halftone :
    PdfObject

    blend_mode :
    PdfObject

    soft_mask :
    PdfObject

    black_point_compensation : String
    marked_content_point : PdfContentMarkedContent?
    marked_content : Array[PdfContentMarkedContent]
    type3_d0 : PdfContentType3D0?
    type3_d1 : PdfContentType3D1?
    state_stack : Array[PdfContentOperatorFrame]
    } derive(Eq, ToJson,
    Debug
    )

    Mutable interpreter state for cpdfcontent-style content stream analysis. It tracks graphics state, text state, marked-content context, Type 3 font metrics, and the saved graphics-state stack.

    PdfContentOperatorState::content_apply_core_op

    Apply cpdfcontent operators whose state effects do not require resources.

    This covers graphics-state stack operators, CTM concatenation, path construction/painting, clipping, path drawing state, direct graphics parameters, text state, marked-content state, and Type 3 glyph metrics. Font lookup, glyph emission, shadings, images, XObjects, and graphics-state dictionaries remain separate resource-backed slices.

    PdfContentOperatorState::content_apply_graphics_parameter_op

    Apply cpdfcontent direct graphics-parameter operators.

    PdfContentOperatorState::content_apply_graphics_state_op

    Apply cpdfcontent graphics-state stack and CTM operators.

    PdfContentOperatorState::content_apply_marked_content_op

    Apply cpdfcontent marked-content state operators.

    PdfContentOperatorState::content_apply_text_show_op

    Apply a text-showing operator and emit cpdfcontent glyph entries.

    PdfContentOperatorState::content_apply_type3_metrics_op

    Apply cpdfcontent Type 3 glyph metric operators d0 and d1.

    PdfContentOperatorState::content_image_entry

    Return the cpdfcontent JSON entry for an image XObject at the current CTM.

    PdfContentOperatorState::content_inline_image_entry

    fn PdfContentOperatorState::content_inline_image_entry(self : PdfContentOperatorState) -> PdfContentJsonEntry

    Return the cpdfcontent JSON entry for an inline image at the current CTM.

    PdfContentOperatorState::content_path_entry

    fn PdfContentOperatorState::content_path_entry(self : PdfContentOperatorState, stroking : Bool) -> PdfContentJsonEntry?

    Return the cpdfcontent JSON entry for the current drawn path, when nonempty.

    PdfContentOperatorState::content_shading_entry

    Return the cpdfcontent JSON entry for a shading, when its bbox is valid.

    PdfContentOperatorState::content_text_glyph_entry

    Return the cpdfcontent JSON entry for one placed text glyph.

    PdfContentOperatorState::content_unit_square_bounding_box

    fn PdfContentOperatorState::content_unit_square_bounding_box(self : PdfContentOperatorState) -> PdfContentBoundingBox

    Return the CTM-transformed unit-square bounding box used for image objects.

    PdfContentOperatorState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorState::equal(PdfContentOperatorState, PdfContentOperatorState) -> Bool

    PdfContentOperatorState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorState::not_equal(x : PdfContentOperatorState, y : PdfContentOperatorState) -> Bool

    PdfContentOperatorState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorState::to_json(PdfContentOperatorState) -> Json

    PdfContentOperatorState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorState::to_repr(PdfContentOperatorState) ->
    Repr

    PdfContentOperatorTextResult

    pub(all) struct PdfContentOperatorTextResult {
    state : PdfContentOperatorState
    entries : Array[PdfContentJsonEntry]
    } derive(Eq, ToJson,
    Debug
    )

    Result of applying a text-related content operator.

    PdfContentOperatorTextResult::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorTextResult::equal(PdfContentOperatorTextResult, PdfContentOperatorTextResult) -> Bool

    PdfContentOperatorTextResult::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorTextResult::not_equal(x : PdfContentOperatorTextResult, y : PdfContentOperatorTextResult) -> Bool

    PdfContentOperatorTextResult::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorTextResult::to_json(PdfContentOperatorTextResult) -> Json

    PdfContentOperatorTextResult::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentOperatorTextResult::to_repr(PdfContentOperatorTextResult) ->
    Repr

    PdfContentPathState

    pub(all) struct PdfContentPathState {
    clipping_path : Array[
    PdfPath
    ]
    colourspace_stroke : PdfColourSpace
    colourspace_non_stroke : PdfColourSpace
    colour_stroke : PdfContentColourValues
    colour_non_stroke : PdfContentColourValues
    line_width : Double
    line_cap : Int
    line_join : Int
    dash_pattern : PdfContentDashPattern
    rendering_intent : String
    } derive(Eq, ToJson,
    Debug
    )

    Path drawing state exported by cpdfcontent's JSON view.

    PdfContentPathState::content_apply_path_state_op

    Apply the cpdfcontent path-state operators that do not require resources.

    PdfContentPathState::content_json

    fn PdfContentPathState::content_json(self : PdfContentPathState) -> Json

    Return cpdfcontent's JSON shape for path drawing state.

    PdfContentPathState::content_with_clipping_path

    Return this path state with a replaced clipping path stack.

    PdfContentPathState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPathState::equal(PdfContentPathState, PdfContentPathState) -> Bool

    PdfContentPathState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPathState::not_equal(x : PdfContentPathState, y : PdfContentPathState) -> Bool

    PdfContentPathState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPathState::to_json(PdfContentPathState) -> Json

    PdfContentPathState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPathState::to_repr(PdfContentPathState) ->
    Repr

    PdfContentPattern

    pub(all) enum PdfContentPattern {
    PdfContentColouredTilingPattern(PdfContentTiling)
    PdfContentUncolouredTilingPattern(PdfContentTiling)
    PdfContentShadingPattern(PdfContentShading)
    } derive(Eq, ToJson,
    Debug
    )

    Parsed pattern resource, either a tiling-pattern placeholder or a shading pattern.

    PdfContentPattern::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPattern::equal(PdfContentPattern, PdfContentPattern) -> Bool

    PdfContentPattern::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPattern::not_equal(x : PdfContentPattern, y : PdfContentPattern) -> Bool

    PdfContentPattern::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPattern::to_json(PdfContentPattern) -> Json

    PdfContentPattern::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentPattern::to_repr(PdfContentPattern) ->
    Repr

    PdfContentRadialShading

    pub(all) struct PdfContentRadialShading {
    radialshading_coords : (Double, Double, Double, Double, Double, Double)
    radialshading_domain : (Double, Double)
    radialshading_function : Array[PdfFunction]
    radialshading_extend : (Bool, Bool)
    } derive(Eq, ToJson,
    Debug
    )

    Radial shading dictionary data.

    PdfContentRadialShading::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentRadialShading::equal(PdfContentRadialShading, PdfContentRadialShading) -> Bool

    PdfContentRadialShading::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentRadialShading::not_equal(x : PdfContentRadialShading, y : PdfContentRadialShading) -> Bool

    PdfContentRadialShading::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentRadialShading::to_json(PdfContentRadialShading) -> Json

    PdfContentRadialShading::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentRadialShading::to_repr(PdfContentRadialShading) ->
    Repr

    PdfContentShading

    Parsed shading with shared colour-space, matrix, graphics-state, and antialias metadata.

    PdfContentShading::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShading::equal(PdfContentShading, PdfContentShading) -> Bool

    PdfContentShading::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShading::not_equal(x : PdfContentShading, y : PdfContentShading) -> Bool

    PdfContentShading::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShading::to_json(PdfContentShading) -> Json

    PdfContentShading::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShading::to_repr(PdfContentShading) ->
    Repr

    PdfContentShadingKind

    pub(all) enum PdfContentShadingKind {
    PdfContentFunctionShading(PdfContentFunctionShading)
    PdfContentAxialShading(PdfContentAxialShading)
    PdfContentRadialShading(PdfContentRadialShading)
    PdfContentFreeFormGouraudShading
    PdfContentLatticeFormGouraudShading
    PdfContentCoonsPatchMesh
    PdfContentTensorProductPatchMesh
    } derive(Eq, ToJson,
    Debug
    )

    Parsed shading kind selected from /ShadingType.

    PdfContentShadingKind::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShadingKind::equal(PdfContentShadingKind, PdfContentShadingKind) -> Bool

    PdfContentShadingKind::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShadingKind::not_equal(x : PdfContentShadingKind, y : PdfContentShadingKind) -> Bool

    PdfContentShadingKind::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShadingKind::to_json(PdfContentShadingKind) -> Json

    PdfContentShadingKind::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentShadingKind::to_repr(PdfContentShadingKind) ->
    Repr

    PdfContentState

    pub(all) enum PdfContentState {
    PdfContentStateGlyph(PdfContentGlyphState)
    PdfContentStatePath(PdfContentPathState)
    PdfContentStateClipping(PdfContentClippingState)
    } derive(Eq, ToJson,
    Debug
    )

    Content state variant carried by one cpdfcontent JSON entry.

    PdfContentState::content_json

    fn PdfContentState::content_json(self : PdfContentState) -> Json

    Return cpdfcontent's JSON shape for a content state variant.

    PdfContentState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentState::equal(PdfContentState, PdfContentState) -> Bool

    PdfContentState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentState::not_equal(x : PdfContentState, y : PdfContentState) -> Bool

    PdfContentState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentState::to_json(PdfContentState) -> Json

    PdfContentState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentState::to_repr(PdfContentState) ->
    Repr

    PdfContentTextFontCacheEntry

    pub(all) struct PdfContentTextFontCacheEntry {
    name : String
    font : PdfFont
    } derive(Eq, ToJson,
    Debug
    )

    Cached font resource resolved while interpreting text operators.

    PdfContentTextFontCacheEntry::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextFontCacheEntry::equal(PdfContentTextFontCacheEntry, PdfContentTextFontCacheEntry) -> Bool

    PdfContentTextFontCacheEntry::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextFontCacheEntry::not_equal(x : PdfContentTextFontCacheEntry, y : PdfContentTextFontCacheEntry) -> Bool

    PdfContentTextFontCacheEntry::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextFontCacheEntry::to_json(PdfContentTextFontCacheEntry) -> Json

    PdfContentTextFontCacheEntry::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextFontCacheEntry::to_repr(PdfContentTextFontCacheEntry) ->
    Repr

    PdfContentTextGlyphPlacement

    pub(all) struct PdfContentTextGlyphPlacement {
    charcode : Int
    text_matrix :
    TransformMatrix

    width : Double
    pvx : Double
    pvy : Double
    advance_x : Double
    advance_y : Double
    bounding_box : PdfContentBoundingBox
    } derive(Eq, ToJson,
    Debug
    )

    Geometry emitted for one glyph by cpdfcontent-style text placement.

    PdfContentTextGlyphPlacement::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextGlyphPlacement::equal(PdfContentTextGlyphPlacement, PdfContentTextGlyphPlacement) -> Bool

    PdfContentTextGlyphPlacement::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextGlyphPlacement::not_equal(x : PdfContentTextGlyphPlacement, y : PdfContentTextGlyphPlacement) -> Bool

    PdfContentTextGlyphPlacement::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextGlyphPlacement::to_json(PdfContentTextGlyphPlacement) -> Json

    PdfContentTextGlyphPlacement::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextGlyphPlacement::to_repr(PdfContentTextGlyphPlacement) ->
    Repr

    PdfContentTextLayout

    pub(all) struct PdfContentTextLayout {
    font_size : Double
    horizontal_scaling : Double
    character_spacing : Double
    word_spacing : Double
    rise : Double
    ctm :
    TransformMatrix

    text_matrix :
    TransformMatrix

    } derive(Eq, ToJson,
    Debug
    )

    Text-state fields needed by cpdfcontent's process_tj glyph placement.

    PdfContentTextLayout::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayout::equal(PdfContentTextLayout, PdfContentTextLayout) -> Bool

    PdfContentTextLayout::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayout::not_equal(x : PdfContentTextLayout, y : PdfContentTextLayout) -> Bool

    PdfContentTextLayout::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayout::to_json(PdfContentTextLayout) -> Json

    PdfContentTextLayout::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayout::to_repr(PdfContentTextLayout) ->
    Repr

    PdfContentTextLayoutResult

    Result of placing one raw PDF text string with cpdfcontent text semantics.

    PdfContentTextLayoutResult::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayoutResult::equal(PdfContentTextLayoutResult, PdfContentTextLayoutResult) -> Bool

    PdfContentTextLayoutResult::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayoutResult::not_equal(x : PdfContentTextLayoutResult, y : PdfContentTextLayoutResult) -> Bool

    PdfContentTextLayoutResult::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayoutResult::to_json(PdfContentTextLayoutResult) -> Json

    PdfContentTextLayoutResult::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextLayoutResult::to_repr(PdfContentTextLayoutResult) ->
    Repr

    PdfContentTextOpResult

    pub(all) struct PdfContentTextOpResult {
    text_state : PdfContentTextState
    glyphs : Array[PdfContentTextGlyphPlacement]
    } derive(Eq, ToJson,
    Debug
    )

    Result of applying a text operator to the current text state.

    PdfContentTextOpResult::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextOpResult::equal(PdfContentTextOpResult, PdfContentTextOpResult) -> Bool

    PdfContentTextOpResult::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextOpResult::not_equal(x : PdfContentTextOpResult, y : PdfContentTextOpResult) -> Bool

    PdfContentTextOpResult::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextOpResult::to_json(PdfContentTextOpResult) -> Json

    PdfContentTextOpResult::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextOpResult::to_repr(PdfContentTextOpResult) ->
    Repr

    PdfContentTextState

    pub(all) struct PdfContentTextState {
    character_spacing : Double
    word_spacing : Double
    horizontal_scaling : Double
    leading : Double
    font : String
    current_font : PdfFont
    font_cache : Array[PdfContentTextFontCacheEntry]
    font_size : Double
    rendering_mode : Int
    rise : Double
    knockout : Bool
    text_matrix :
    TransformMatrix

    line_matrix :
    TransformMatrix

    } derive(Eq, ToJson,
    Debug
    )

    Text state tracked by cpdfcontent before glyph layout is emitted.

    PdfContentTextState::content_apply_text_op

    Apply cpdfcontent text-state and text-showing operators with a known font.

    PdfContentTextState::content_apply_text_state_op

    Apply cpdfcontent text-state operators that do not require font resources.

    PdfContentTextState::content_cache_font

    fn PdfContentTextState::content_cache_font(self : PdfContentTextState, name : String, font : PdfFont) -> PdfContentTextState

    Cache a resolved font resource and make it the current text font.

    PdfContentTextState::content_cached_font

    fn PdfContentTextState::content_cached_font(self : PdfContentTextState, name : String) -> PdfFont?

    Return a previously resolved font resource by resource name.

    PdfContentTextState::content_glyph_state

    Return the JSON-facing glyph state for a text state and clipping path.

    PdfContentTextState::content_text_layout

    Convert text state to the layout input used by cpdfcontent glyph placement.

    PdfContentTextState::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextState::equal(PdfContentTextState, PdfContentTextState) -> Bool

    PdfContentTextState::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextState::not_equal(x : PdfContentTextState, y : PdfContentTextState) -> Bool

    PdfContentTextState::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextState::to_json(PdfContentTextState) -> Json

    PdfContentTextState::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTextState::to_repr(PdfContentTextState) ->
    Repr

    PdfContentTiling

    pub(all) enum PdfContentTiling {
    PdfContentTiling
    } derive(Eq, ToJson,
    Debug
    )

    Placeholder for a tiling pattern; detailed tiling-paint payloads are not expanded by the content reader yet.

    PdfContentTiling::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTiling::equal(PdfContentTiling, PdfContentTiling) -> Bool

    PdfContentTiling::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTiling::not_equal(x : PdfContentTiling, y : PdfContentTiling) -> Bool

    PdfContentTiling::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTiling::to_json(PdfContentTiling) -> Json

    PdfContentTiling::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentTiling::to_repr(PdfContentTiling) ->
    Repr

    PdfContentType3D0

    pub(all) struct PdfContentType3D0 {
    width_x : Double
    width_y : Double
    } derive(Eq, ToJson,
    Debug
    )

    Type 3 font d0 width declaration captured from a character procedure.

    PdfContentType3D0::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D0::equal(PdfContentType3D0, PdfContentType3D0) -> Bool

    PdfContentType3D0::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D0::not_equal(x : PdfContentType3D0, y : PdfContentType3D0) -> Bool

    PdfContentType3D0::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D0::to_json(PdfContentType3D0) -> Json

    PdfContentType3D0::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D0::to_repr(PdfContentType3D0) ->
    Repr

    PdfContentType3D1

    pub(all) struct PdfContentType3D1 {
    width_x : Double
    width_y : Double
    llx : Double
    lly : Double
    urx : Double
    ury : Double
    } derive(Eq, ToJson,
    Debug
    )

    Type 3 font d1 width and bounding-box declaration captured from a character procedure.

    PdfContentType3D1::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D1::equal(PdfContentType3D1, PdfContentType3D1) -> Bool

    PdfContentType3D1::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D1::not_equal(x : PdfContentType3D1, y : PdfContentType3D1) -> Bool

    PdfContentType3D1::to_json

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D1::to_json(PdfContentType3D1) -> Json

    PdfContentType3D1::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfContentType3D1::to_repr(PdfContentType3D1) ->
    Repr

    PdfDecryptionResult

    pub(all) struct PdfDecryptionResult {
    document : PdfDocument
    denied_permissions : Array[
    PdfPermission
    ]
    } derive(Eq,
    Debug
    )

    Result of successfully decrypting a document.

    document is a decrypted copy with encryption removed from the trailer and saved encryption state attached. denied_permissions is decoded from the original /P permission mask.

    PdfDecryptionResult::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfDecryptionResult::equal(PdfDecryptionResult, PdfDecryptionResult) -> Bool

    PdfDecryptionResult::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfDecryptionResult::not_equal(x : PdfDecryptionResult, y : PdfDecryptionResult) -> Bool

    PdfDecryptionResult::to_repr

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfDecryptionResult::to_repr(PdfDecryptionResult) ->
    Repr

    PdfDocument

    pub struct PdfDocument {
    major : Int
    minor : Int
    root : Int
    objects : PdfObjects
    trailer_dict :
    PdfObject

    was_linearized : Bool
    saved_encryption :
    PdfSavedEncryption
    ?
    first_xref : Int
    revision_read : Int
    } derive(Eq,
    Debug
    )

    In-memory representation of one PDF document.

    A document stores the PDF version, catalog root number, object table, trailer dictionary, linearization flag, saved encryption metadata, first xref offset, and the revision count read from the input.

    PdfDocument::add_annotation

    Return a page value with an annotation prepended to /Annots.

    The annotation is written as a direct dictionary. Existing annotation arrays are preserved after the new entry; a non-array /Annots value raises.

    PdfDocument::add_bookmark_title

    fn PdfDocument::add_bookmark_title(self : PdfDocument, filename : String, use_title : Bool) -> PdfDocument raise
    PdfError

    Add a top-level title bookmark pointing at page one.

    Existing bookmarks are indented by one level. When use_title is true, the document metadata title is preferred, matching cpdf's XMP-over-Info precedence; otherwise the basename of filename is used.

    PdfDocument::add_bookmarks

    Return a copy of the document with its outline tree replaced.

    The input must be in preorder using zero-based level values. Empty input removes existing bookmarks. New outline objects are allocated after the current maximum object number.

    PdfDocument::add_bookmarks_from_json

    fn PdfDocument::add_bookmarks_from_json(self : PdfDocument, json : Json, verify? : Bool) -> PdfDocument raise
    PdfError

    Return a copy of the document with bookmarks imported from cpdf JSON rows.

    PdfDocument::add_bookmarks_from_text

    fn PdfDocument::add_bookmarks_from_text(self : PdfDocument, data : BytesView, verify? : Bool) -> PdfDocument raise
    PdfError

    Return a copy of the document with bookmarks imported from cpdf text bytes.

    PdfDocument::add_object

    fn PdfDocument::add_object(self : PdfDocument, object :
    PdfObject
    , generation? : Int) -> Int

    Add a parsed object using the next available object number.

    Returns the allocated object number and records an object-altered event.

    PdfDocument::add_object_given_number

    fn PdfDocument::add_object_given_number(self : PdfDocument, number : Int, object :
    PdfObject
    , generation? : Int) -> Unit

    Add or replace a parsed object at an explicit object number.

    This records an object-altered event and updates the maximum object number if needed.

    PdfDocument::add_page_labels

    fn PdfDocument::add_page_labels(self : PdfDocument, progress : Bool, style :
    PdfPageLabelStyle
    , prefix : Bytes?, start_value : Int, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Add page-label ranges to the selected one-based page numbers.

    page_numbers is interpreted in its existing order; contiguous runs are labelled as ranges. When progress is true, each later range starts after the number of pages already labelled by earlier ranges.

    PdfDocument::add_page_labels_json

    fn PdfDocument::add_page_labels_json(self : PdfDocument, json : Json) -> PdfDocument raise
    PdfError

    Add page labels from cpdf's JSON page-label array shape.

    Each entry must contain labelstyle, labelprefix, startpage, and startvalue. Prefix strings are interpreted as UTF-8 and encoded as compact PDFDocStrings, matching cpdf's add_page_labels_json.

    PdfDocument::add_pagetree

    Add a balanced page tree for pages and return its root object number.

    Page content objects that are not already indirect are inserted into the document. The document is mutated in place.

    PdfDocument::add_prefix

    fn PdfDocument::add_prefix(self : PdfDocument, prefix : String) -> Unit raise
    PdfError

    Prefix all page resource names and corresponding content references.

    If split content streams cannot be parsed independently, content streams are merged first. This mutates the document in place and is useful before combining pages from multiple documents.

    PdfDocument::add_root

    Add or replace the catalog root pointing at a page-tree root.

    Existing catalog entries are preserved except /Type and /Pages; extras can add or replace other catalog entries. The document trailer /Root is updated and the document is mutated in place.

    PdfDocument::addtext_bookmark_for_page

    fn PdfDocument::addtext_bookmark_for_page(self : PdfDocument, bookmarks : ArrayView[
    PdfBookmark
    ], level : Int, page_number : Int) -> String raise
    PdfError

    Return cpdf add-text's current bookmark text at level for page_number.

    The search is constrained to the current bookmark branch so section bookmarks from a previous chapter do not leak into a later chapter.

    PdfDocument::addtext_calc_textwidth

    fn PdfDocument::addtext_calc_textwidth(self : PdfDocument, page :
    PdfPage
    , font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_size : Double, text : BytesView) -> Double raise
    PdfError

    Measure text bytes with cpdf add-text's selected font mode.

    This ports the local calc_textwidth branch in cpdfaddtext.ml. Font packs interpret text as UTF-8 so codepoints can select pack members; selected parsed fonts and existing page fonts treat text as the PDF text bytes to measure.

    PdfDocument::addtext_existing_font_resource

    Resolve an existing page font for cpdf add-text.

    The requested name is first treated as a /Font resource key. If that is absent, the page font dictionary is scanned for an entry whose /BaseFont matches the requested name; the returned @core.PdfName is the resource key to use in emitted text operators.

    PdfDocument::addtext_line_page

    fn PdfDocument::addtext_line_page(self : PdfDocument, page :
    PdfPage
    , time :
    PdfStrftimeTime
    , lines : ArrayView[String], replacements : ArrayView[(String, () -> String)], font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_object :
    PdfObject
    ?, fontpack_font_objects : ArrayView[Int], font_size : Double, text : String, colour :
    PdfContentColour
    , position :
    PdfPosition
    , relative_to_box? :
    PdfName
    , horizontal_offset? : Double, vertical_offset? : Double, shift_x? : Double, shift_y? : Double, opacity? : Double, justification? :
    PdfAddTextJustification
    , rotation? :
    PdfAddTextRotation
    , outline? : Bool, line_width? : Double, underneath? : Bool, fast? : Bool, raw? : Bool, url_border? : Bool) ->
    PdfPage
    raise
    PdfError

    Add one prepared cpdf add-text line to a page.

    This is the single-page counterpart of cpdf's local addtext_page: it prepares text and placement, installs resources, emits /CPDFSTAMP text operators, creates URL annotations, and appends or prepends the content.

    PdfDocument::addtext_line_widths

    Measure cpdf add-text's current line and expanded paragraph widths.

    This ports the local textwidth, allwidths, and longest_w block in cpdfaddtext.ml after replacement expansion and URL stripping.

    PdfDocument::addtext_opacity_resources

    Return resources updated with cpdf add-text opacity graphics state.

    Opacity values below 1.0 allocate a unique /gs* entry under /ExtGState with both fill and stroke alpha set. Opaque values leave the resource dictionary unchanged and return no graphics-state name.

    PdfDocument::addtext_page_font_dictionary

    Return the page font resource object used by cpdf add-text setup.

    Missing /Font resources are treated as an empty dictionary. Present values are resolved through the document and returned as-is, matching cpdf's Pdf.lookup_direct setup before unique font-name allocation.

    PdfDocument::addtext_page_label

    fn PdfDocument::addtext_page_label(self : PdfDocument, page_number : Int) -> String raise
    PdfError

    Return cpdf add-text's visible page label for a 1-based page number.

    Documents without page labels fall back to decimal page numbers.

    PdfDocument::addtext_page_lines

    fn PdfDocument::addtext_page_lines(self : PdfDocument, page :
    PdfPage
    , time :
    PdfStrftimeTime
    , lines : ArrayView[String], replacements : ArrayView[(String, () -> String)], font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_object :
    PdfObject
    ?, fontpack_font_objects : ArrayView[Int], font_size : Double, line_spacing : Double, colour :
    PdfContentColour
    , position :
    PdfPosition
    , relative_to_box? :
    PdfName
    , opacity? : Double, justification? :
    PdfAddTextJustification
    , rotation? :
    PdfAddTextRotation
    , midline? : Bool, topline? : Bool, shift_x? : Double, shift_y? : Double, outline? : Bool, line_width? : Double, underneath? : Bool, fast? : Bool, raw? : Bool, url_border? : Bool) ->
    PdfPage
    raise
    PdfError

    Add all cpdf add-text lines to one page using cpdf paragraph advancement.

    This ports the outer per-line loop around cpdf's local addtext call: initial multi-line offsets, midline/topline baseline adjustment, repeated line emission, and rotation-dependent line advancement.

    PdfDocument::addtext_page_rest_with_annotations

    Return a page rest dictionary with cpdf add-text annotations prepended.

    Empty new annotation lists leave rest unchanged. Existing /Annots arrays are resolved through document; missing or malformed values are treated as empty, matching cpdf's add-text page update.

    PdfDocument::addtext_pages_with_font

    fn PdfDocument::addtext_pages_with_font(self : PdfDocument, page_numbers : ArrayView[Int], lines : ArrayView[String], time :
    PdfStrftimeTime
    , bookmarks : ArrayView[
    PdfBookmark
    ], font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_object :
    PdfObject
    ?, fontpack_font_objects : ArrayView[Int], font_size : Double, line_spacing : Double, colour :
    PdfContentColour
    , position :
    PdfPosition
    , filename? : String, bates? : Int, bates_pad? : Int?, relative_to_box? :
    PdfName
    , shift? : String, opacity? : Double, justification? :
    PdfAddTextJustification
    , rotation? :
    PdfAddTextRotation
    , midline? : Bool, topline? : Bool, outline? : Bool, line_width? : Double, underneath? : Bool, fast? : Bool, raw? : Bool, url_border? : Bool) -> PdfDocument raise
    PdfError

    Add cpdf add-text lines to selected pages with an already resolved font.

    This ports the document/page-selection layer after font selection: selected one-based pages get page-local replacement callbacks, cpdf shift-coordinate parsing, and page-line emission. Font embedding and existing-font discovery remain separate slices.

    PdfDocument::addtext_prepare_line

    Prepare one cpdf add-text line for later content and annotation emission.

    This ports the source-level block which expands page-local replacement fields, strips %URL[text|url] markup, measures the current and paragraph line widths, and resolves the final cpdf placement offsets.

    PdfDocument::addtext_rectangle

    fn PdfDocument::addtext_rectangle(self : PdfDocument, page_numbers : ArrayView[Int], coord : String, colour :
    PdfContentColour
    , position :
    PdfPosition
    , relative_to_box? :
    PdfName
    , outline? : Bool, line_width? : Double, opacity? : Double, underneath? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Add a cpdf-style rectangle stamp to selected one-based pages.

    The rectangle dimensions are parsed with cpdf coordinate syntax, placed relative to relative_to_box, wrapped as /CPDFSTAMP artifact content, and appended unless underneath is set.

    PdfDocument::addtext_replacement_values

    fn PdfDocument::addtext_replacement_values(self : PdfDocument, bookmarks : ArrayView[
    PdfBookmark
    ], page_number : Int, end_page : Int, filename : String, bates : Int, bates_pad : Int?) ->
    PdfAddTextReplacementValues
    raise
    PdfError

    Build cpdf add-text replacement values from document-local state.

    PdfDocument::addtext_resource_setup

    Prepare page resources for one cpdf add-text line.

    Selected-font and fontpack modes install new /Font entries and optional opacity resources. Existing-named-font mode reuses the page resources unchanged and suppresses opacity graphics state selection, matching cpdf's font = None branch.

    PdfDocument::addtext_selected_font_object

    Write the selected cpdf add-text font and return its indirect reference.

    Existing-named-font mode has no selected font to write, so None is preserved for callers that later reuse the page's current font resource.

    PdfDocument::addtext_url_annotation_references

    fn PdfDocument::addtext_url_annotation_references(self : PdfDocument, text : String, urls : ArrayView[
    PdfAddTextUrl
    ], measure : (String) -> Double raise
    PdfError
    , origin :
    Point2
    , horizontal_offset : Double, vertical_offset : Double, justification_offset : Double, rotation : Double, rotation_offset :
    Point2
    , page_rotation : Double, font : PdfFont?, fontname : String, font_size : Double, url_border : Bool) -> Array[
    PdfObject
    ] raise
    PdfError

    Build indirect URL link annotations for one cpdf add-text line.

    This mirrors cpdf's add-text annotation pass: each parsed URL span is measured against the visible line, converted to transformed quad points, and written as a new indirect annotation object.

    PdfDocument::addtext_width_of_existing_font_resource

    fn PdfDocument::addtext_width_of_existing_font_resource(self : PdfDocument, page :
    PdfPage
    , fontname :
    PdfName
    , font_size : Double, text : BytesView) -> (
    PdfName
    , Double) raise
    PdfError

    Measure add-text bytes using an existing page font resource.

    PdfDocument::addtexts_with_font

    fn PdfDocument::addtexts_with_font(self : PdfDocument, page_numbers : ArrayView[Int], text : String, time :
    PdfStrftimeTime
    , bookmarks : ArrayView[
    PdfBookmark
    ], font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_size : Double, line_spacing : Double, colour :
    PdfContentColour
    , position :
    PdfPosition
    , filename? : String, bates? : Int, bates_pad? : Int?, relative_to_box? :
    PdfName
    , shift? : String, opacity? : Double, justification? :
    PdfAddTextJustification
    , rotation? :
    PdfAddTextRotation
    , midline? : Bool, topline? : Bool, outline? : Bool, line_width? : Double, underneath? : Bool, fast? : Bool, raw? : Bool, url_border? : Bool) -> PdfDocument raise
    PdfError

    Add cpdf add-text to selected pages with deterministic time and resolved fonts.

    This ports the outer source-level addtexts orchestration once callers have already chosen an existing font, parsed font, or font pack. It prepares the input text lines, skips empty visible output before writing fonts, writes selected/fontpack font objects, and delegates page rewriting to addtext_pages_with_font.

    PdfDocument::addtexts_with_source

    fn PdfDocument::addtexts_with_source(self : PdfDocument, page_numbers : ArrayView[Int], text : String, time :
    PdfStrftimeTime
    , bookmarks : ArrayView[
    PdfBookmark
    ], font_source : PdfAddTextFontSource, fontname :
    PdfName
    , font_size : Double, line_spacing : Double, colour :
    PdfContentColour
    , position :
    PdfPosition
    , filename? : String, bates? : Int, bates_pad? : Int?, relative_to_box? :
    PdfName
    , shift? : String, opacity? : Double, justification? :
    PdfAddTextJustification
    , rotation? :
    PdfAddTextRotation
    , midline? : Bool, topline? : Bool, outline? : Bool, line_width? : Double, underneath? : Bool, fast? : Bool, raw? : Bool, url_border? : Bool) -> PdfDocument raise
    PdfError

    Add cpdf add-text to selected pages from a non-embedding font source.

    PdfDocument::all_pages_upright

    fn PdfDocument::all_pages_upright(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bool raise
    PdfError

    Return whether selected pages are rotation-free and have a near-zero origin.

    This ports cpdf's allupright predicate. Like the source, page numbers outside the document are ignored rather than treated as a range error.

    PdfDocument::all_pages_upright_only

    fn PdfDocument::all_pages_upright_only(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bool raise
    PdfError

    Return whether selected pages have no page dictionary rotation.

    This ports cpdf's alluprightonly, which intentionally does not require a (0, 0) media-box origin and ignores out-of-range page numbers.

    PdfDocument::annotations_json

    fn PdfDocument::annotations_json(self : PdfDocument, page_numbers : ArrayView[Int]) -> Json raise
    PdfError

    Return cpdf's annotation JSON export for selected pages.

    Only indirect page annotation entries are exported, matching cpdf's JSON path. Page-object references in /P, /Dest, and action /D destinations without /Dest are rewritten to 1-based page numbers. Referenced ancillary objects are appended after annotation entries, excluding /Popup and /Parent links.

    PdfDocument::annotations_json_blob

    fn PdfDocument::annotations_json_blob(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bytes raise
    PdfError

    Return cpdf's annotation JSON export as UTF-8 JSON bytes.

    PdfDocument::annotations_of_page

    Read annotations from a page's /Annots array.

    Missing or malformed /Annots entries are treated as no annotations. When a popup annotation and its parent both appear in the page array, the parent is skipped and represented through AnnotationPopup.

    PdfDocument::append_page_content

    fn PdfDocument::append_page_content(self : PdfDocument, page_numbers : ArrayView[Int], content : BytesView, before? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Append or prepend parsed content bytes to selected one-based pages.

    content is byte-oriented PDF content syntax, matching the OCaml source's string payload. Empty content is a no-op.

    PdfDocument::append_page_content_multiple

    fn PdfDocument::append_page_content_multiple(self : PdfDocument, contents : ArrayView[Bytes], before? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Append or prepend one content byte payload per page.

    The payload list must match the current page count. Empty per-page payloads leave that page unchanged.

    PdfDocument::append_page_content_multiple_ops

    fn PdfDocument::append_page_content_multiple_ops(self : PdfDocument, op_lists : ArrayView[Array[
    PdfContentOp
    ]], before? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Append or prepend one content operator list per page.

    PdfDocument::append_page_content_ops

    fn PdfDocument::append_page_content_ops(self : PdfDocument, page_numbers : ArrayView[Int], ops : ArrayView[
    PdfContentOp
    ], before? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Append or prepend content operators to selected one-based pages.

    PdfDocument::apply_redaction_type

    fn PdfDocument::apply_redaction_type(self : PdfDocument, annotation_type : String, page_numbers : ArrayView[Int]) -> Unit

    Apply annotations of annotation_type as if they were redactions.

    This mirrors the current cpdf stub, which intentionally performs no work.

    PdfDocument::apply_redactions

    fn PdfDocument::apply_redactions(self : PdfDocument, page_numbers : ArrayView[Int]) -> Unit

    Apply redaction annotations.

    This mirrors the current cpdf stub, which intentionally performs no work.

    PdfDocument::attach_file

    fn PdfDocument::attach_file(self : PdfDocument, filename : String, data : BytesView, keep_version? : Bool, page_number? : Int?, relationship? : String?, description? : String?) -> PdfDocument raise
    PdfError

    Attach an in-memory file payload to the document or to a one-based page.

    The original document is left unchanged. filename supplies the attachment basename; the payload bytes are copied. When keep_version is false, PDF versions below 1.4 are bumped to 1.4 as in cpdf.

    PdfDocument::black_fills

    Paint fills on selected one-based pages and Form XObjects with colour.

    PdfDocument::black_lines

    Paint line strokes on selected one-based pages and Form XObjects with colour.

    PdfDocument::black_text

    Paint text on selected one-based pages and Form XObjects with colour.

    PdfDocument::bookmark_name_of_spec

    fn PdfDocument::bookmark_name_of_spec(self : PdfDocument, encoding :
    PdfMetadataEncoding
    , bookmarks : ArrayView[
    PdfBookmark
    ], split_level : Int, spec : String, sequence : Int, filename : String, start_page : Int, end_page : Int) -> String raise
    PdfError

    Expand cpdf's bookmark-based output filename specification.

    This ports the output-side name_of_spec helper. Bookmark-file parsing is intentionally separate; callers pass the already-read bookmark list.

    PdfDocument::bookmarks_json

    fn PdfDocument::bookmarks_json(self : PdfDocument, json_preserve_actions? : Bool) -> Json raise
    PdfError

    Return cpdf's full-document bookmark JSON listing.

    PdfDocument::bookmarks_json_blob

    fn PdfDocument::bookmarks_json_blob(self : PdfDocument, json_preserve_actions? : Bool) -> Bytes raise
    PdfError

    Return cpdf's full-document bookmark JSON listing as UTF-8 JSON bytes.

    PdfDocument::bookmarks_open_to_level

    fn PdfDocument::bookmarks_open_to_level(self : PdfDocument, level : Int) -> PdfDocument raise
    PdfError

    Return a copy of the document whose bookmarks are open below level.

    PdfDocument::bpc

    Compatibility alias for PdfDocument::image_bits_per_component.

    PdfDocument::build_name_tree

    Build a PDF name tree from byte-string keys and object values.

    Entries are sorted by byte order. Empty input produces a leaf tree with an empty /Names array; larger inputs are split into child nodes with /Limits entries, allocating child objects in self as needed.

    PdfDocument::build_number_tree

    Build a PDF number tree from integer keys and object values.

    Entries are sorted numerically. Empty input produces a leaf tree with an empty /Nums array; larger inputs are split into child nodes with /Limits entries, allocating child objects in self as needed.

    PdfDocument::catalog

    Return the resolved document catalog object.

    A /Root entry in the trailer dictionary is preferred over the stored root number. The selected reference is resolved through direct; if it resolves to PdfNull, this raises @core.PdfError::RootExpected.

    PdfDocument::catalog_item

    fn PdfDocument::catalog_item(self : PdfDocument, key :
    PdfName
    ) -> String

    Return a catalog item in cpdf's text-reporting form.

    PdfDocument::catalog_item_string

    fn PdfDocument::catalog_item_string(self : PdfDocument, key : String) -> String

    Return a catalog item for a cpdf-style slash-prefixed string key.

    PdfDocument::center_to_fit

    fn PdfDocument::center_to_fit(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)]) -> PdfDocument raise
    PdfError

    Compatibility method using cpdfpage's center_to_fit name.

    PdfDocument::center_to_fit_pages

    fn PdfDocument::center_to_fit_pages(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)]) -> PdfDocument raise
    PdfError

    Centre selected pages on page-indexed target sizes without scaling content.

    This ports cpdf's center_to_fit composition: selected pages receive new media and crop boxes, art and bleed boxes are removed, then all known boxes are shifted by offsets calculated from the original page crop/media bounds.

    PdfDocument::change_boxes

    fn PdfDocument::change_boxes(self : PdfDocument, page :
    PdfPage
    , transform : (Double, Double, Double, Double) -> (Double, Double, Double, Double)) ->
    PdfPage
    raise
    PdfError

    Change /MediaBox and known page boxes with a coordinate transform.

    The callback receives (min_x, min_y, max_x, max_y) and returns replacement bounds. This ports cpdf's single-page change_boxes helper.

    PdfDocument::change_id

    fn PdfDocument::change_id(self : PdfDocument, path : String, get_time : () -> Double) -> Unit raise
    PdfError

    Replaces this document's trailer /ID entry.

    Raises @core.PdfError::DictionaryExpected if the trailer is not a dictionary.

    PdfDocument::change_pages

    Replace the document page tree with pages.

    When change_references is true, page-object references in destinations, actions, annotations, and bookmarks are rewritten from the old page set to the new one. matrices can transform destination coordinates for pages whose geometry changed, and changes can map old page serials to new serials when page counts differ.

    PdfDocument::change_pattern_matrices_page

    Rewrite pattern matrices used by a page after applying a page transform.

    PdfDocument::chop

    fn PdfDocument::chop(self : PdfDocument, x : Int, y : Int, columns : Bool, btt : Bool, rtl : Bool, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Chop selected pages into an x by y grid.

    The page crop box is preferred when present. Chopped pages receive only a new media box; inherited/crop/trim/bleed/art boxes and annotations are removed from each generated piece, matching cpdf's chop behavior.

    PdfDocument::chop_hv

    fn PdfDocument::chop_hv(self : PdfDocument, is_h : Bool, line : Double, columns : Bool, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Chop selected pages horizontally or vertically at line.

    PdfDocument::colour_space_components

    Return the number of components required by a colour-space object.

    Resource names are resolved through the supplied resources dictionary. Pattern spaces without a base colour space are rejected because their paint operators do not consume ordinary colour components.

    PdfDocument::colspace

    Compatibility alias for PdfDocument::image_colour_space.

    PdfDocument::combine_pages

    fn PdfDocument::combine_pages(self : PdfDocument, overlay : PdfDocument, fast? : Bool, scale_to_fit? : Bool, overlay_is_under? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Combine each page in this document with the corresponding page of overlay.

    The overlay is truncated or padded with blank A4 pages to match the under document length. Overlay resources are prefixed before merging, and bookmarks from both inputs are retained on the paired output pages.

    PdfDocument::combine_pdf_resources

    Merge two page resource dictionaries.

    Known resource categories such as /Font, /XObject, and /ColorSpace are concatenated; unknown top-level entries from both dictionaries are preserved. Later duplicate resource names are not renamed here.

    PdfDocument::combine_pdf_rests

    Merge two page rest dictionaries for future imposition support.

    Unknown entries from both dictionaries are preserved. /Annots arrays are resolved from either dictionary and concatenated, matching the CamlPDF cpdfimpose helper without porting the full imposition pipeline yet.

    PdfDocument::composition

    Return cpdf-style composition buckets for a document.

    The result order is stable: images, fonts, content streams, structure info, attached files, xref table, piece info, then unclassified bytes.

    PdfDocument::composition_json

    fn PdfDocument::composition_json(self : PdfDocument, file_size : Int) -> Json raise
    PdfError

    Return the document composition in cpdf JSON row format.

    PdfDocument::composition_json_blob

    fn PdfDocument::composition_json_blob(self : PdfDocument, file_size : Int) -> Bytes raise
    PdfError

    Return the document composition serialized as UTF-8 JSON bytes.

    PdfDocument::composition_text

    fn PdfDocument::composition_text(self : PdfDocument, file_size : Int) -> Bytes raise
    PdfError

    Return the text that cpdf's show_composition prints when json=false.

    PdfDocument::contains_javascript

    fn PdfDocument::contains_javascript(self : PdfDocument) -> Bool

    Return whether parsed document objects or the root names tree contain cpdf-style JavaScript markers.

    This follows cpdf's historical checks: /URI strings are detected only when they begin with lowercase javascript:, and /S is detected only when its resolved value is the PDF string /JavaScript.

    PdfDocument::content_apply_extgstate_alpha_op

    Apply cpdfcontent alpha parameters from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_compositing_op

    fn PdfDocument::content_apply_extgstate_compositing_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply blend mode, soft mask and black-point compensation from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_dash_op

    Apply cpdfcontent dash parameters from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_font_op

    Apply cpdfcontent font state from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_graphics_parameter_op

    fn PdfDocument::content_apply_extgstate_graphics_parameter_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply cpdfcontent scalar graphics parameters from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_halftone_op

    fn PdfDocument::content_apply_extgstate_halftone_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply cpdfcontent halftone objects from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_overprint_op

    fn PdfDocument::content_apply_extgstate_overprint_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply cpdfcontent overprint parameters from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_rendering_op

    fn PdfDocument::content_apply_extgstate_rendering_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply cpdfcontent smoothness and stroke-adjustment from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_resource_op

    Apply the gs operator: the ExtGState dictionary name in the resources' /ExtGState. (cpdfcontent applies the whole /ExtGState resource dictionary instead, so its gs never takes effect.)

    PdfDocument::content_apply_extgstate_text_op

    Apply cpdfcontent text-state fields from a resolved ExtGState dictionary.

    PdfDocument::content_apply_extgstate_transfer_op

    fn PdfDocument::content_apply_extgstate_transfer_op(self : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Apply cpdfcontent transfer-function objects from a resolved ExtGState dictionary.

    PdfDocument::content_apply_font_resource_op

    Apply cpdfcontent's resource-backed Tf font lookup and cache update.

    PdfDocument::content_apply_resource_op

    Apply one cpdfcontent operator with resource-backed entry emission.

    PdfDocument::content_apply_text_resource_op

    Apply cpdfcontent text operators that depend on page resources or font data.

    PdfDocument::content_entries_of_ops

    Collect cpdfcontent JSON entries for one non-recursive content-operator list.

    PdfDocument::content_entries_of_ops_recursive

    Collect cpdfcontent JSON entries for content operators, recursively walking Forms.

    PdfDocument::content_entries_of_page

    Collect recursive cpdfcontent JSON entries for one page.

    PdfDocument::content_filter

    Walk content entries, call predicate for each one, and return the original ops.

    PdfDocument::content_form_xobject_enter_state

    Look up a named Form XObject resource and return the state used to enter it.

    PdfDocument::content_form_xobject_ops

    Look up a named Form XObject resource and parse its content operators.

    PdfDocument::content_form_xobject_resources

    Look up a named Form XObject resource and return the resources used inside it.

    PdfDocument::content_image_entry_from_resources

    Look up a named image XObject resource and return its cpdfcontent JSON entry.

    PdfDocument::content_json_of_ops

    Serialize recursive cpdfcontent entries for one already-parsed operator list.

    PdfDocument::content_json_of_page

    Serialize recursive cpdfcontent entries for one page.

    PdfDocument::content_read_axial_shading

    Read a /ShadingType 2 axial shading dictionary.

    PdfDocument::content_read_function_shading

    Read a /ShadingType 1 function-based shading dictionary.

    PdfDocument::content_read_pattern

    Look up and read a named pattern resource.

    PdfDocument::content_read_radial_shading

    Read a /ShadingType 3 radial shading dictionary.

    PdfDocument::content_read_shading

    Read a shading dictionary and preserve the surrounding pattern matrix and graphics-state dictionary supplied by the caller.

    PdfDocument::content_read_shading_pattern

    Read a /PatternType 2 shading pattern dictionary.

    PdfDocument::content_shading_entry_from_resources

    Look up a named shading resource and return its cpdfcontent JSON entry.

    PdfDocument::contents_of_name_tree

    Return the immediate key-value pairs contained in a name or number tree.

    The tree may store entries directly in /Names or /Nums, or indirectly in child nodes under /Kids. Entries are returned as raw @syntax.PdfObject pairs, so callers that need typed name or number keys should use read_name_tree or read_number_tree.

    PdfDocument::copy

    fn PdfDocument::copy(self : PdfDocument) -> PdfDocument

    Deep-copy the document object table and trailer.

    Parsed object containers and stream data are copied so mutations to the copy do not alter the original document's object graph.

    PdfDocument::copy_annotations_from

    fn PdfDocument::copy_annotations_from(self : PdfDocument, source : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Return a copy of this document with annotations copied from source.

    PdfDocument::copy_box

    fn PdfDocument::copy_box(self : PdfDocument, page_numbers : ArrayView[Int], from_box : String, to_box : String, mediabox_if_missing? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper using cpdfpage's string page-box names.

    PdfDocument::copy_font_from

    fn PdfDocument::copy_font_from(self : PdfDocument, source : PdfDocument, font_name : String, font_page : Int, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Copy a named font from source onto selected pages of this document.

    This ports cpdf's copy_font: both documents are first renumbered into one non-overlapping object space, the direct source font dictionary is added to selected target pages under its /BaseFont name, and all objects referenced by the copied font dictionary are copied into the target document.

    PdfDocument::copy_id_from

    fn PdfDocument::copy_id_from(self : PdfDocument, source : PdfDocument, keep_version? : Bool) -> PdfDocument raise
    PdfError

    Copy the trailer /ID from source onto this document.

    The original document is left unchanged. When keep_version is false, PDF 1.x outputs are bumped to at least 1.1, matching cpdf.

    PdfDocument::copy_page_box

    fn PdfDocument::copy_page_box(self : PdfDocument, page_numbers : ArrayView[Int], from_box :
    PdfName
    , to_box :
    PdfName
    , mediabox_if_missing? : Bool) -> PdfDocument raise
    PdfError

    Copy one page-box value to another on selected pages.

    Missing source boxes leave the page unchanged unless mediabox_if_missing is true, in which case the page /MediaBox is copied.

    PdfDocument::create_metadata

    Create a fresh XMP metadata stream from the document /Info dictionary.

    PdfDocument::crop_pages

    fn PdfDocument::crop_pages(self : PdfDocument, page_numbers : ArrayView[Int], boxes : ArrayView[(Double, Double, Double, Double)], box_name? :
    PdfName
    ) -> PdfDocument raise
    PdfError

    Set a named page box on selected pages from a page-indexed (x, y, width,height) list.

    This ports cpdf's crop_pdf. By default it writes /CropBox; box_name can target another page-box dictionary entry. The selected pages use boxes[page_number - 1].

    PdfDocument::crop_pdf_string

    fn PdfDocument::crop_pdf_string(self : PdfDocument, page_numbers : ArrayView[Int], boxes : ArrayView[(Double, Double, Double, Double)], box_name? : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper using cpdfpage's string page-box names.

    PdfDocument::debug_objects

    fn PdfDocument::debug_objects(self : PdfDocument) -> Bytes raise
    PdfError

    Render the CamlPDF-style object dump used by cpdf debugging tools.

    The result is byte-oriented because PDF names, strings, and stream bodies are byte sequences in both CamlPDF and this package. Returning bytes also keeps tests exact without relying on stdout capture.

    PdfDocument::decompress

    Decode supported filter stages from every parsed stream in the document.

    Encrypted documents are left unchanged. Unsupported filters are preserved with their remaining encoded bytes, matching pdf_decode_stream_until_unknown.

    PdfDocument::decrypt_single_stream

    fn PdfDocument::decrypt_single_stream(self : PdfDocument, object_number : Int, generation : Int, stream :
    PdfObject
    , user_password? : BytesView?, owner_password? : BytesView?, no_encrypt_metadata? : Bool) ->
    PdfObject
    ? raise
    PdfError

    Decrypt one encrypted stream object with available passwords.

    Unencrypted documents return stream unchanged. Encrypted documents return None when no supplied password authenticates. The caller supplies the stream object's number and generation because object keys depend on them.

    PdfDocument::decrypt_with_owner_password

    fn PdfDocument::decrypt_with_owner_password(self : PdfDocument, password : BytesView, no_encrypt_metadata? : Bool) -> PdfDecryptionResult? raise
    PdfError

    Decrypt with an owner password only.

    Unencrypted documents return a copied document and empty denied permissions. Encrypted documents return None when the owner password does not authenticate.

    PdfDocument::decrypt_with_passwords

    fn PdfDocument::decrypt_with_passwords(self : PdfDocument, user_password? : BytesView?, owner_password? : BytesView?, no_encrypt_metadata? : Bool) -> PdfDecryptionResult? raise
    PdfError

    Decrypt this document using optional user and owner passwords.

    If the document is not encrypted, a copied document and empty permissions list are returned. If it is encrypted and no password works, the result is None; malformed encryption data still raises @core.PdfError.

    PdfDocument::decrypt_with_user_password

    fn PdfDocument::decrypt_with_user_password(self : PdfDocument, password : BytesView, no_encrypt_metadata? : Bool) -> PdfDecryptionResult? raise
    PdfError

    Decrypt with a user password only.

    Unencrypted documents return a copied document and empty denied permissions. Encrypted documents return None when the user password does not authenticate.

    PdfDocument::determine_subformats

    fn PdfDocument::determine_subformats(self : PdfDocument) -> Array[String] raise
    PdfError

    Determine PDF/A, PDF/E, PDF/UA, PDF/VT, and PDF/X subformat markers.

    This ports cpdf's in-memory subformat detection. It recognizes simple XMP element and attribute forms and falls back to /Info /GTS_PDFXVersion.

    PdfDocument::dict_entries_json

    Return dictionary entry values in cpdf-style JSON format.

    PdfDocument::dict_entries_json_string

    fn PdfDocument::dict_entries_json_string(self : PdfDocument, key : String, utf8? : Bool) -> Bytes raise
    PdfError

    Return dictionary entry values in cpdf-style JSON for a slash-prefixed key.

    PdfDocument::dict_entry_rendered_values

    Render dictionary entry values as PDF object syntax.

    This is the side-effect-free native equivalent of cpdf's print_dict_entry.

    PdfDocument::dict_entry_rendered_values_string

    fn PdfDocument::dict_entry_rendered_values_string(self : PdfDocument, key : String) -> Array[Bytes] raise
    PdfError

    Render dictionary entry values for a cpdf-style slash-prefixed string key.

    PdfDocument::dict_entry_values

    Return resolved values for dictionary entries named key.

    Traversal mirrors cpdf's dictionary-entry reporting helpers: direct nested dictionaries, arrays, stream dictionaries, all parsed document objects, and the trailer are scanned. The matching value itself is resolved through the document object table.

    PdfDocument::direct

    Resolve an object through the document object table.

    Direct objects are returned unchanged. Indirect references are followed recursively through parsed entries in self.objects; missing, unparsed, or excessively deep references resolve to PdfNull rather than raising.

    PdfDocument::draft

    fn PdfDocument::draft(self : PdfDocument, only_remove :
    PdfName
    ?, boxes : Bool, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Remove image XObjects and inline images from selected pages.

    When only_remove is present, only matching image XObject invocations are removed and inline images are retained. When boxes is true, removed images are replaced by a crossed unit box, matching cpdf's draft mode.

    PdfDocument::draw

    fn PdfDocument::draw(self : PdfDocument, page_numbers : ArrayView[Int], drawops : ArrayView[PdfDrawOp], struct_tree? : Bool, fast? : Bool, underneath? : Bool, filename? : String, bates? : Int, bates_pad? : Int?, time? :
    PdfStrftimeTime
    ?, add_artifacts? : Bool, role_map? : String) -> PdfDocument raise
    PdfError

    Draw cpdf draw operations on selected pages.

    This ports the page orchestration from cpdfdraw.ml: draw operations are split around PdfDrawNewPage, selected page ranges are advanced or padded between chunks, resources are merged into page resources, manual artifact back-channel markers are fixed before writing content, and struct_tree writes a fresh structure tree from rendered MCIDs only when the document has cpdf's fresh /StructTreeRoot placeholder. If a real structure tree is already present, or no fresh placeholder exists, requested structure mode artifacts the drawn content instead of replacing the tree. When role_map is not empty, it is parsed as the body of a PDF role-map dictionary and attached to the generated /StructTreeRoot.

    PdfDocument::draw_special_text_context

    fn PdfDocument::draw_special_text_context(self : PdfDocument, page_number : Int, filename? : String, bates? : Int, bates_pad? : Int?, time? :
    PdfStrftimeTime
    ?) -> PdfDrawSpecialTextContext raise
    PdfError

    Build cpdf draw special-text context for one page of a document.

    PdfDocument::embed_truetype

    fn PdfDocument::embed_truetype(self : PdfDocument, fontfile : BytesView, fontname : String, codepoints : ArrayView[Int], encoding : PdfEncoding) -> PdfFontPack raise
    PdfError

    Embed a TrueType font using cpdf's simple-font split strategy.

    This mirrors Cpdfembed.embed_truetype: an empty codepoint list returns an empty font pack without parsing the font bytes, while non-empty input is parsed through pdf_truetype_parse, adds one /FontFile2 stream per returned subset, and builds the Unicode-to-(font, charcode) lookup table.

    PdfDocument::encrypt_128bit

    fn PdfDocument::encrypt_128bit(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with the revision-3 128-bit ARC4 handler.

    denied_permissions is converted to the PDF /P mask. file_id can be supplied for deterministic output; when omitted, a generated file ID is added as needed.

    PdfDocument::encrypt_128bit_aesv2

    fn PdfDocument::encrypt_128bit_aesv2(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with revision-4 AESV2 using native randomness.

    Fresh random IVs are generated for encrypted strings and streams. When file_id is empty, a random 16-byte first trailer ID is generated before deriving the encryption key.

    PdfDocument::encrypt_128bit_aesv2_with_iv_provider

    fn PdfDocument::encrypt_128bit_aesv2_with_iv_provider(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], iv_provider : (Int, Int, Int) -> Bytes raise
    PdfError
    , encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with revision-4 AESV2.

    iv_provider supplies per-object 16-byte CBC IVs by object number, generation, and IV index. This makes tests reproducible while allowing production callers to provide secure random IVs.

    PdfDocument::encrypt_128bit_r4

    fn PdfDocument::encrypt_128bit_r4(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with revision-4 128-bit ARC4.

    This writes a crypt-filter dictionary using /V2. encrypt_metadata=false follows the revision-4 no-metadata key derivation and stream policy.

    PdfDocument::encrypt_256bit_aesv3

    fn PdfDocument::encrypt_256bit_aesv3(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], iso? : Bool, encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with AESV3/AES-256 using native randomness.

    Native random bytes supply the file key, salts, permissions padding, and per-object IVs. Set iso=true for the ISO/PDF 2.0 AESV3 hash variant.

    PdfDocument::encrypt_256bit_aesv3_iso

    fn PdfDocument::encrypt_256bit_aesv3_iso(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with the ISO AESV3/AES-256 variant.

    This is the native-random convenience wrapper for encrypt_256bit_aesv3 with iso=true.

    PdfDocument::encrypt_256bit_aesv3_iso_with_providers

    fn PdfDocument::encrypt_256bit_aesv3_iso_with_providers(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], random_provider : (
    PdfAesV3RandomField
    , Int) -> Bytes raise
    PdfError
    , iv_provider : (Int, Int, Int) -> Bytes raise
    PdfError
    , encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with the ISO AESV3/AES-256 variant.

    This is a convenience wrapper around encrypt_256bit_aesv3_with_providers with iso=true.

    PdfDocument::encrypt_256bit_aesv3_with_providers

    fn PdfDocument::encrypt_256bit_aesv3_with_providers(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], random_provider : (
    PdfAesV3RandomField
    , Int) -> Bytes raise
    PdfError
    , iv_provider : (Int, Int, Int) -> Bytes raise
    PdfError
    , iso? : Bool, encrypt_metadata? : Bool, file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with AESV3/AES-256 security.

    random_provider supplies the file key, salts, and permissions padding; iv_provider supplies CBC IVs for encrypted strings and streams. iso=true selects the ISO/PDF 2.0 hash variant.

    PdfDocument::encrypt_40bit

    fn PdfDocument::encrypt_40bit(self : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], file_id? : BytesView) -> PdfDocument raise
    PdfError

    Encrypt a copy of the document with the revision-2 40-bit ARC4 handler.

    denied_permissions is converted to the PDF /P mask. file_id can be supplied for deterministic output; when omitted, the document gets a CamlPDF-style generated file ID.

    PdfDocument::endpage

    Return the number of pages by walking the page tree.

    PdfDocument::endpage_fast

    Return the root page-tree /Count value without validating child pages.

    Missing or malformed counts return 0.

    PdfDocument::equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfDocument::equal(PdfDocument, PdfDocument) -> Bool

    PdfDocument::event_log

    fn PdfDocument::event_log(self : PdfDocument) -> Array[(Int, PdfObjectEvent)]

    Return a copy of the document object mutation log.

    PdfDocument::extract_fontfile_bytes

    fn PdfDocument::extract_fontfile_bytes(self : PdfDocument, page_number : Int, font_name : String) -> Bytes? raise
    PdfError

    Return decoded embedded font-file bytes for a named page font, if present.

    This is the in-memory counterpart to cpdf's extract_fontfile, which writes the decoded font program to a path. Missing names or fonts without embedded font programs return None; malformed font dictionaries or font-file stream objects raise through the normal PDF error path.

    PdfDocument::extract_images_files

    fn PdfDocument::extract_images_files(self : PdfDocument, page_numbers : ArrayView[Int], stem : String, encoding? :
    PdfMetadataEncoding
    , inline? : Bool, dedup? : Bool, dedup_per_page? : Bool) -> Array[PdfExtractedImageFile] raise
    PdfError

    Return the files cpdfimage's extract_images would write for page XObjects.

    This ports the in-memory extraction side: page image XObjects, indirect soft masks, recursive Form XObject image traversal, optional inline images, cpdf filename expansion, and cpdf's indirect-image deduplication modes. Decoded image data is emitted as raw PNM; external conversion and mask composition are handled by native/file wrappers when available.

    PdfDocument::extract_single_image_files

    fn PdfDocument::extract_single_image_files(self : PdfDocument, object_number : Int, stem : String) -> Array[PdfExtractedImageFile] raise
    PdfError

    Return the files cpdfimage's extract_single_image would write.

    Encoded JPEG, JPEG2000, and JBIG2 images keep their encoded payloads. Other supported images are decoded through get_image_24bpp and emitted as binary PNM (P6) RGB files. An indirect /SMask is emitted with the -smask stem, matching cpdf's single-image extraction path.

    PdfDocument::extract_struct_tree

    Extract the PDF/UA structure-tree object graph as cpdf-style CPDFJSON.

    PdfDocument::find_object_by_spec

    Find an object using cpdf's object-spec grammar.

    "" selects the trailer dictionary, /A/B follows a trailer-rooted chain, 4/A follows a chain from object 4, and P1/A follows a chain from the first page object.

    PdfDocument::first_xref

    fn PdfDocument::first_xref(self : PdfDocument) -> Int

    Return the byte offset of the first xref section read from the input.

    PdfDocument::flip_pages_horizontally

    fn PdfDocument::flip_pages_horizontally(self : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Flip selected pages horizontally around the horizontal centre of each page's /MediaBox.

    This ports cpdf's hflip_pdf: page content, annotations, pattern matrices, and destination coordinates are transformed, while page boxes are left unchanged.

    PdfDocument::flip_pages_vertically

    fn PdfDocument::flip_pages_vertically(self : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Flip selected pages vertically around the vertical centre of each page's /MediaBox.

    This ports cpdf's vflip_pdf: page content, annotations, pattern matrices, and destination coordinates are transformed, while page boxes are left unchanged.

    PdfDocument::font_from_name

    fn PdfDocument::font_from_name(self : PdfDocument, font_name : String, page_number : Int) ->
    PdfObject
    raise
    PdfError

    Resolve a cpdf font name path on a page.

    font_name is the name shown by list_fonts, such as /F1 for a page font or /Fm/FX for a font inside a Form XObject. Valid pages whose path is not found return PdfNull.

    PdfDocument::font_table

    Return cpdf's font encoding table rows for one named page font.

    This is the in-memory counterpart to cpdf's print_font_table. Font names use the same page resource path syntax as font_from_name, such as /F1.

    PdfDocument::font_table_text

    fn PdfDocument::font_table_text(self : PdfDocument, font_name : String, page_number : Int) -> Bytes raise
    PdfError

    Render cpdf's plain-text font encoding table for one named page font.

    PdfDocument::fonts_json

    fn PdfDocument::fonts_json(self : PdfDocument, page_numbers : ArrayView[Int]) -> Json raise
    PdfError

    Return cpdf's JSON font listing for selected pages.

    PdfDocument::fonts_json_blob

    fn PdfDocument::fonts_json_blob(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bytes raise
    PdfError

    Return cpdf's JSON font listing as UTF-8 JSON bytes.

    PdfDocument::get_annotations

    Return old-style annotation contents as (page_number, contents) pairs.

    Every annotation entry contributes one pair. Annotations without /Contents contribute an empty byte string, matching cpdf's old list behavior.

    PdfDocument::get_image_24bpp

    Extract an image as either encoded image bytes or 24bpp RGB data.

    DCT/JPEG, JPX/JPEG2000, and JBIG2 streams are returned still encoded. Other supported image streams are decoded, have supported /Decode arrays applied, and are converted to PdfRawImage(width, height, PdfBPP24, data) where data is RGBRGB byte order.

    PdfDocument::get_number

    The object is resolved first. PDF real numbers are returned directly and PDF integers are widened to Double; any other object raises @core.PdfError::NumberExpected.

    PdfDocument::hard_box

    fn PdfDocument::hard_box(self : PdfDocument, page_numbers : ArrayView[Int], box_name :
    PdfName
    , mediabox_if_missing? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Hard-clip selected pages to a page box by prepending a clipping rectangle.

    page_numbers are 1-based. box_name is usually /MediaBox, /CropBox, /TrimBox, /ArtBox, or /BleedBox. Missing non-media boxes raise unless mediabox_if_missing is true. In fast mode the clip stream is prepended without parsing existing content.

    PdfDocument::hard_box_string

    fn PdfDocument::hard_box_string(self : PdfDocument, page_numbers : ArrayView[Int], box_name : String, mediabox_if_missing? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper using cpdfpage's string page-box names.

    PdfDocument::has_page_box

    fn PdfDocument::has_page_box(self : PdfDocument, page_number : Int, box_name :
    PdfName
    ) -> Bool raise
    PdfError

    Return whether a 1-based page has a named non-media page box.

    This mirrors cpdf's hasbox: invalid page numbers raise, and the check is performed against the page's explicit dictionary entries rather than treating /MediaBox as always present.

    PdfDocument::hasbox_string

    fn PdfDocument::hasbox_string(self : PdfDocument, page_number : Int, box_name : String) -> Bool raise
    PdfError

    Compatibility wrapper using cpdfpage's string page-box names.

    PdfDocument::hflip_pdf

    fn PdfDocument::hflip_pdf(self : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility method using cpdfpage's hflip_pdf name.

    PdfDocument::image_bits_per_component

    Return an image's /BitsPerComponent or abbreviated /BPC entry.

    Image masks default to 1 when no explicit value is present. The raw object is returned to preserve the PDF representation.

    PdfDocument::image_colour_space

    Read an image XObject colour space.

    /ImageMask true images are treated as PdfDeviceGray. Otherwise this reads /ColorSpace or /CS, resolving named spaces through resources.

    PdfDocument::image_resolution

    fn PdfDocument::image_resolution(self : PdfDocument, page_numbers : ArrayView[Int], dpi : Double, inline? : Bool) -> Array[(Int, String, Int, Int, Double, Double, Int)] raise
    PdfError

    Report image resolutions for selected pages.

    Results match cpdf's tuple order: page number, XObject name, image width, image height, horizontal DPI, vertical DPI, and object number. Entries are kept when either axis is below dpi.

    PdfDocument::image_resolution_json

    fn PdfDocument::image_resolution_json(self : PdfDocument, page_numbers : ArrayView[Int], dpi : Double, inline? : Bool) -> Json raise
    PdfError

    Report image resolution data as cpdf-style JSON rows.

    PdfDocument::image_resolution_json_blob

    fn PdfDocument::image_resolution_json_blob(self : PdfDocument, page_numbers : ArrayView[Int], dpi : Double, inline? : Bool) -> Bytes raise
    PdfError

    Report image resolution data as UTF-8 JSON bytes.

    PdfDocument::images_json

    fn PdfDocument::images_json(self : PdfDocument, page_numbers : ArrayView[Int], inline? : Bool) -> Json raise
    PdfError

    List image XObjects referenced by selected pages as cpdf-style JSON rows.

    PdfDocument::images_json_blob

    fn PdfDocument::images_json_blob(self : PdfDocument, page_numbers : ArrayView[Int], inline? : Bool) -> Bytes raise
    PdfError

    List image XObjects referenced by selected pages as UTF-8 JSON bytes.

    PdfDocument::import_page

    fn PdfDocument::import_page(self : PdfDocument, source : PdfPageSource, page_number : Int) -> PdfImportedPage raise
    PdfError

    Import page page_number (1-based) of source into this document as a Form XObject. Like prawn-templates (which asciidoctor-pdf uses), the page and the objects it needs are copied, here into a Form XObject rather than a page: what is drawn is the page's visible box (the media box clipped to the crop box), turned upright by its /Rotate and scaled by its /UserUnit, with its content and resources. Annotations, the structure tree and other document-level data are not imported.

    The page's content stream keeps its filters and encoded bytes (several content streams are joined and compressed); every object the page's resources (and transparency /Group) reach is copied under a new object number, streams with their encoded data, so the source document is left as it was. References to the source's page tree nodes, or to any other page or page tree node, are not followed and become null. Importing the same page twice copies it twice.

    Raises what PdfPageSource::page_display_size raises, HardError for direct objects nested more than 256 deep in a copied object, and the reader's errors for malformed content. Everything is copied before this document changes, so a failed import leaves it as it was: no object added, no object number taken, nothing in its event log.

    PdfDocument::impose

    fn PdfDocument::impose(self : PdfDocument, x : Double, y : Double, fit? : Bool, columns? : Bool, rtl? : Bool, btt? : Bool, center? : Bool, margin? : Double, spacing? : Double, line_width? : Double, fast? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Impose pages into cpdf-style sheets.

    In non-fit mode, x and y are grid dimensions; one of them may be zero to stack all pages in the other direction. In fit mode, x and y are the output page width and height, and the grid is calculated from the current page size.

    PdfDocument::indirect_number

    Return the indirect object number stored under a dictionary key.

    The containing object is resolved before lookup, but the entry itself is inspected before dereferencing. This returns Some(number) only when the immediate entry value is PdfIndirect(number).

    PdfDocument::info_blob

    Return cpdf-style document information report fields as stdout-style UTF-8 bytes.

    PdfDocument::info_json

    Return cpdf-style document information report fields as JSON.

    PdfDocument::info_json_blob

    Return cpdf-style document information report fields as UTF-8 JSON bytes.

    PdfDocument::info_utf8

    Return one /Info dictionary entry as a UTF-8 string.

    PdfDocument::info_utf8_string

    fn PdfDocument::info_utf8_string(self : PdfDocument, key : String) -> String

    Return one cpdf-style slash-prefixed string-key /Info entry as UTF-8.

    PdfDocument::is_cidkeyed_font

    fn PdfDocument::is_cidkeyed_font(self : PdfDocument, font :
    PdfObject
    ) -> Bool

    Return true if a font dictionary is a Type 0 CID-keyed font.

    PdfDocument::is_encrypted

    fn PdfDocument::is_encrypted(self : PdfDocument) -> Bool

    Return true when the trailer contains an /Encrypt entry.

    PdfDocument::is_missing_font

    fn PdfDocument::is_missing_font(self : PdfDocument, font :
    PdfObject
    ) -> Bool

    Return whether a font dictionary has no embedded font program.

    Type 3 fonts are never reported as missing, matching cpdf. Other fonts are missing when they have no /FontDescriptor, or when their descriptor lacks /FontFile, /FontFile2, and /FontFile3.

    PdfDocument::is_simple_font

    Return true if a font dictionary has a simple-font subtype.

    PdfDocument::is_standard14_font

    fn PdfDocument::is_standard14_font(self : PdfDocument, font :
    PdfObject
    ) -> Bool

    Return true if a font dictionary is an unembedded standard 14 font.

    A matching Type1 or TrueType /BaseFont without explicit /Widths is treated as a standard-font dictionary.

    PdfDocument::is_xfa

    fn PdfDocument::is_xfa(self : PdfDocument) -> Bool

    Return true when the catalog contains an AcroForm XFA entry.

    PdfDocument::iter_objects

    fn PdfDocument::iter_objects(self : PdfDocument, callback : (Int,
    PdfObject
    ) -> Unit raise) -> Unit raise

    Iterate over parsed objects in object-number order.

    The callback receives (number, object). Errors raised by the callback propagate to the caller.

    PdfDocument::iter_objects_in_order

    fn PdfDocument::iter_objects_in_order(self : PdfDocument, callback : (Int,
    PdfObject
    ) -> Unit raise) -> Unit raise

    Iterate over parsed objects in object-number order.

    This is the explicit-order variant used by iter_objects.

    PdfDocument::iter_objects_with_generation

    fn PdfDocument::iter_objects_with_generation(self : PdfDocument, callback : (Int, Int,
    PdfObject
    ) -> Unit raise) -> Unit raise

    Iterate over parsed objects with their generation numbers.

    The callback receives (number, generation, object) in object-number order, and any callback error is propagated.

    PdfDocument::iter_pages

    Iterate over selected pages in document order.

    Page numbers outside the document are ignored.

    PdfDocument::iter_stream

    fn PdfDocument::iter_stream(self : PdfDocument, callback : (
    PdfObject
    ) -> Unit raise) -> Unit raise

    Iterate over parsed stream objects in object-number order.

    The callback receives the stream as a @syntax.PdfObject so callers can use the same object-level helpers as for values read from arrays or dictionaries.

    PdfDocument::json_of_document

    fn PdfDocument::json_of_document(self : PdfDocument, utf8? : Bool, parse_content? : Bool, clean_strings? : Bool, no_stream_data? : Bool, decompress_streams? : Bool) -> Json raise
    PdfError

    Convert an in-memory document to CPDFJSON format with stream data included.

    This ports the basic document-output shape from cpdf's json_of_pdf: object -1 carries CPDFJSON metadata, object 0 carries the trailer, and positive object numbers reachable from the trailer or stored root are emitted in ascending order. When parse_content is set, page /Contents streams plus referenced Form XObject and Pattern streams are emitted as cpdf-style operation arrays, after multi-stream pages are precombined on a prepared copy of the document. When clean_strings is set for non-UTF8 output, UTF-16BE strings in positive objects are simplified while the trailer dictionary is left unchanged to match cpdf's /ID precaution. When no_stream_data is set, ordinary stream data is elided and CPDFJSON metadata records that omission. When decompress_streams is set, positive object streams are decoded through supported filters until the first unknown filter.

    PdfDocument::json_of_document_blob

    fn PdfDocument::json_of_document_blob(self : PdfDocument, utf8? : Bool, parse_content? : Bool, clean_strings? : Bool, no_stream_data? : Bool, decompress_streams? : Bool) -> Bytes raise
    PdfError

    Render full-document CPDFJSON as UTF-8 bytes.

    This is the side-effect-free byte-output counterpart of cpdf's Cpdfjson.to_output.

    PdfDocument::json_of_object

    fn PdfDocument::json_of_object(self : PdfDocument, object :
    PdfObject
    , utf8? : Bool, clean_strings? : Bool, no_stream_data? : Bool, parse_content? : Bool) -> Json raise
    PdfError

    Convert a single PDF object to CPDFJSON format.

    This exposes the single-object output side of cpdf's cpdfjson conversion. clean_strings mirrors cpdf's deprecated -output-json-clean-strings behavior for non-UTF8 output, and no_stream_data emits cpdf's stream-data elision placeholder. When parse_content is set, /FunctionType streams are decoded before output, matching cpdf's single-object parse-content behavior. Full document CPDFJSON import/export and parsed content-stream encoding are handled by json_of_document.

    PdfDocument::json_to_output

    fn PdfDocument::json_to_output(self : PdfDocument, utf8? : Bool, parse_content? : Bool, no_stream_data? : Bool, decompress_streams? : Bool, clean_strings? : Bool) -> Bytes raise
    PdfError

    Source-spelled compatibility wrapper for cpdfjson's to_output.

    The OCaml API writes to an output sink; this wrapper returns the same UTF-8 bytes that would be written, while preserving cpdf's flag order.

    PdfDocument::language

    fn PdfDocument::language(self : PdfDocument) -> Bytes?

    Return the catalog /Lang value, if present.

    PdfDocument::language_string

    fn PdfDocument::language_string(self : PdfDocument) -> String?

    Return the catalog /Lang value as text for cpdf-style string APIs.

    PdfDocument::list_annotations

    Render cpdf's old-style annotation listing for selected pages.

    Unlike get_annotations, this suppresses empty /Contents entries and returns the bytes cpdf would print instead of writing to stdout.

    PdfDocument::list_attached_files

    List document-level and page-level file attachments.

    PdfDocument::list_bookmarks

    fn PdfDocument::list_bookmarks(self : PdfDocument, page_numbers : ArrayView[Int], encoding? :
    PdfMetadataEncoding
    , json? : Bool, json_preserve_actions? : Bool) -> Bytes raise
    PdfError

    Render cpdf's bookmark listing for selected pages.

    Text output matches cpdf's line-oriented bookmark format. When json is set, this returns UTF-8 JSON bytes for the same filtered bookmark set.

    PdfDocument::list_fonts

    Return cpdf's font resource listing for selected pages.

    The listing walks page /Resources dictionaries and nested Form XObject resources. Duplicate indirect XObjects are processed once per call, matching cpdf's intended "do not process an xobject twice" behavior.

    PdfDocument::list_fonts_text

    fn PdfDocument::list_fonts_text(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bytes raise
    PdfError

    Render cpdf's plain-text font listing for selected pages.

    PdfDocument::list_spot_colours

    Return spot colourant names from top-level /Separation colour-space objects.

    This follows cpdf's list_spot_colours scan: it iterates document objects and reports arrays whose first entry is /Separation; nested arrays inside dictionaries are not recursively scanned by this helper.

    PdfDocument::list_spot_colours_blob

    fn PdfDocument::list_spot_colours_blob(self : PdfDocument) -> Bytes

    Return the bytes cpdf's list_spot_colours would print to stdout.

    PdfDocument::lookup_chain

    An empty key sequence returns Some(start). If any step cannot be resolved, the result is None.

    PdfDocument::lookup_direct

    Look up key in a dictionary or stream dictionary and resolve the value.

    The containing object is first passed through direct. If the object is not dictionary-like, the key is absent, or the resolved value is PdfNull, this returns None.

    PdfDocument::lookup_direct_or_array

    Look up a dictionary entry, or address an array by a pseudo-key.

    Names that begin with /[ followed by decimal digits are treated as array indexes when object is a PdfArray; other names are resolved with lookup_direct. The returned value is resolved through direct.

    PdfDocument::lookup_direct_or_else

    Look up either of two alternative dictionary keys.

    first_key is preferred. second_key is checked only when the first lookup is absent or resolves to PdfNull.

    PdfDocument::lookup_object_or_null

    fn PdfDocument::lookup_object_or_null(self : PdfDocument, number : Int) ->
    PdfObject

    Return a parsed object by number, or PdfNull if it is absent or deferred.

    PdfDocument::lookup_required

    Look up a required dictionary entry and resolve the value.

    This is the raising counterpart to lookup_direct: it raises the caller supplied error when the containing object is not dictionary-like, when the key is absent, or when the resolved value is PdfNull.

    PdfDocument::map_objects_in_place

    Transform every parsed document object in place.

    Deferred entries remain deferred and are not passed to transform.

    PdfDocument::map_pages

    Map selected pages in document order.

    Page numbers outside the document are ignored.

    PdfDocument::mark_all_as_artifact

    Mark every page content stream and referenced Form XObject as a PDF/UA artifact.

    PdfDocument::mark_info_item

    fn PdfDocument::mark_info_item(self : PdfDocument, key :
    PdfName
    ) -> Bool

    Return a /MarkInfo boolean item, or false when absent/malformed.

    PdfDocument::mark_pdfua1

    Return a copy of the document marked as PDF/UA-1 in its XMP metadata.

    PdfDocument::mark_pdfua2

    Return a copy of the document marked as PDF/UA-2 for the given revision year.

    PdfDocument::merge_content_streams

    fn PdfDocument::merge_content_streams(self : PdfDocument) -> Unit raise
    PdfError

    Merge multi-stream page contents into single decoded streams.

    Only page-like objects with /Resources are considered. The document is mutated in place and stream filters are decoded before concatenation.

    PdfDocument::merge_name_trees_no_clash

    Merge several name trees when the caller guarantees there are no clashes.

    Entries are read from every input tree and rebuilt into a single sorted name tree. This function does not report duplicate keys; callers that require conflict handling should check the inputs before calling it.

    PdfDocument::merge_number_trees_no_clash

    Merge several number trees when the caller guarantees there are no clashes.

    Entries are read from every input tree and rebuilt into a single sorted number tree. Duplicate-key handling follows the read/build helpers and is not reported as an error.

    PdfDocument::metadata

    Extract the catalog metadata XML stream, decoding supported stream filters.

    PdfDocument::missing_fonts

    Return cpdf's missing-font report for selected pages.

    This follows cpdf's current behavior by inspecting page /Font resources and descendant fonts. It does not recurse into Form XObjects; the cpdf source marks that as a separate FIXME.

    PdfDocument::missing_fonts_return

    fn PdfDocument::missing_fonts_return(self : PdfDocument, page_numbers : ArrayView[Int]) -> Array[(Int, String, String, String, String)] raise
    PdfError

    Return cpdffont's missing_fonts_return tuple rows.

    PdfDocument::missing_fonts_text

    fn PdfDocument::missing_fonts_text(self : PdfDocument, page_numbers : ArrayView[Int]) -> Bytes raise
    PdfError

    Render cpdf's plain-text missing-font report for selected pages.

    PdfDocument::name_tree_lookup

    Look up a byte-string key in a PDF name tree.

    The BytesView key is copied into an owned PdfString because PDF objects own their byte storage. Prefer this method when the key is already available as PDF-encoded bytes.

    PdfDocument::name_tree_lookup_object

    Look up a raw key object in a PDF name tree or number tree.

    /Limits entries are used to skip child nodes when they are comparable with key. The lookup accepts both direct leaf arrays and nested /Kids nodes, returning None for malformed nodes or missing keys.

    PdfDocument::not_equal

    #deprecated("implicit trait-method promotion is being removed; call via the trait")
    fn PdfDocument::not_equal(x : PdfDocument, y : PdfDocument) -> Bool

    PdfDocument::number_tree_lookup

    Look up an integer key in a PDF number tree.

    PdfDocument::object_count

    fn PdfDocument::object_count(self : PdfDocument) -> Int

    Return the number of entries in the document object table.

    PdfDocument::object_numbers

    fn PdfDocument::object_numbers(self : PdfDocument) -> Array[Int]

    Return document object numbers in ascending order.

    PdfDocument::ocg_coalesce

    Return a copy with same-named optional-content groups coalesced.

    The first group for each raw PDF name is kept. Duplicate group references in optional-content metadata and parsed document objects are rewritten to the kept object number, and duplicate OCG objects are removed.

    PdfDocument::ocg_get_list

    Return the raw PDF string names of catalog optional-content groups.

    This mirrors cpdf's ocg_get_list: missing optional-content metadata yields an empty list, and malformed individual group entries are skipped.

    PdfDocument::ocg_list

    fn PdfDocument::ocg_list(self : PdfDocument, json : Bool) -> Bytes raise
    PdfError

    Return cpdf's optional-content group listing output.

    PdfDocument::ocg_list_json

    Return cpdf's optional-content group JSON listing.

    PdfDocument::ocg_list_json_blob

    fn PdfDocument::ocg_list_json_blob(self : PdfDocument) -> Bytes raise
    PdfError

    Return cpdf's optional-content group JSON listing as UTF-8 JSON bytes.

    PdfDocument::ocg_order_all

    Return a copy of the document with every OCG listed in the default /Order.

    Documents without optional-content properties, without /OCGs, or without a default /D dictionary are returned unchanged.

    PdfDocument::ocg_rename

    fn PdfDocument::ocg_rename(self : PdfDocument, old_name : Bytes, new_name : Bytes) -> PdfDocument

    Return a copy of the document with matching optional-content group names replaced.

    PdfDocument::ocg_replace_json

    Return a copy with catalog /OCProperties replaced from cpdf OCG JSON.

    PdfDocument::open_action

    Return the catalog /OpenAction in cpdf's reporting form.

    Destination arrays beginning with a page indirect reference are rewritten to one-based page numbers. For GoTo action dictionaries with /D, the destination is returned; other action objects are returned unchanged.

    PdfDocument::open_action_json_blob

    fn PdfDocument::open_action_json_blob(self : PdfDocument) -> Bytes raise
    PdfError

    Return the catalog /OpenAction as cpdf-style JSON bytes.

    PdfDocument::open_action_string

    fn PdfDocument::open_action_string(self : PdfDocument) -> String raise
    PdfError

    Return the catalog /OpenAction as cpdf-style PDF syntax.

    PdfDocument::output_page_info

    fn PdfDocument::output_page_info(self : PdfDocument, page_numbers : ArrayView[Int], unit? :
    PdfUnit
    , json? : Bool, raisejson? : Bool) -> Bytes raise
    PdfError

    Return the bytes cpdfpage's output_page_info would print.

    raisejson is accepted for source-shape compatibility with cpdf's internal JSON exception path; this MoonBit wrapper returns JSON bytes directly when json=true.

    PdfDocument::pad_after

    fn PdfDocument::pad_after(self : PdfDocument, page_numbers : ArrayView[Int], pad_with? : PdfDocument?) -> PdfDocument raise
    PdfError

    Insert blank pages or pages from pad_with after selected one-based pages.

    PdfDocument::pad_before

    fn PdfDocument::pad_before(self : PdfDocument, page_numbers : ArrayView[Int], pad_with? : PdfDocument?) -> PdfDocument raise
    PdfError

    Insert blank pages or pages from pad_with before selected one-based pages.

    PdfDocument::pad_to_multiple

    fn PdfDocument::pad_to_multiple(self : PdfDocument, multiple : Int) -> PdfDocument raise
    PdfError

    Pad a document to a page count that is a multiple of multiple.

    Positive multiples append blank pages. Negative multiples prepend them. A multiple of zero is invalid.

    PdfDocument::page_content_json

    fn PdfDocument::page_content_json(self : PdfDocument, page_numbers : ArrayView[Int]) -> Json raise
    PdfError

    Return cpdf's page-content JSON array for selected 1-based page numbers.

    PdfDocument::page_info_json

    Return cpdf's page-info JSON array for selected 1-based page numbers.

    PdfDocument::page_info_json_blob

    fn PdfDocument::page_info_json_blob(self : PdfDocument, page_numbers : ArrayView[Int], unit? :
    PdfUnit
    ) -> Bytes raise
    PdfError

    Return cpdf's page-info JSON array as UTF-8 bytes.

    PdfDocument::page_info_text

    Render cpdf's plain-text page-info report for selected pages.

    PdfDocument::page_number_of_target

    Resolve a destination target to a 1-based page number.

    PdfDocument::page_object_number

    fn PdfDocument::page_object_number(self : PdfDocument, page_number : Int) -> Int? raise
    PdfError

    Return the object number for a 1-based page number.

    Out-of-range page numbers return None.

    PdfDocument::page_reference_numbers

    fn PdfDocument::page_reference_numbers(self : PdfDocument) -> Array[Int] raise
    PdfError

    Return page object numbers in page-tree order.

    PdfDocument::pages_of_pagetree

    Read the document page tree into @page.PdfPage records.

    Inherited resources, media boxes, crop boxes, and rotation are resolved while walking the tree. Malformed page-tree structure raises @core.PdfError.

    PdfDocument::pages_of_pagetree_quick

    fn PdfDocument::pages_of_pagetree_quick(self : PdfDocument) -> Int raise
    PdfError

    Count pages by walking the page tree without materializing @page.PdfPage records.

    PdfDocument::parse_bookmark_json

    Parse cpdf's bookmark JSON array.

    PdfDocument::parse_bookmark_text

    Parse cpdf's plain text bookmark-file format.

    The input is byte-oriented. Bookmark titles are double-quoted UTF-8 text with cpdf's \\, \", and \n escapes; optional destinations are double-quoted PDF object snippets such as [1 /Fit].

    PdfDocument::parse_cmap

    Decode and parse a CMap stream object in this document.

    The stream is decoded through its first filter, stream-dictionary metadata is merged with parsed metadata, and indirect /UseCMap bases are composed with cycle protection. Malformed or non-stream inputs raise @core.PdfError.

    PdfDocument::parse_content_bytes_with_resources

    Parse content bytes with page resources.

    This is the owned-byte wrapper for parse_content_view_with_resources.

    PdfDocument::parse_content_ops

    Decode and parse a list of content stream objects from this document.

    Each input must resolve to a stream object. Stream filters are decoded before parsing, then the decoded streams are concatenated with whitespace. Use parse_content_ops_with_resources when inline-image length inference needs page resources.

    PdfDocument::parse_content_ops_with_resources

    Decode and parse content stream objects with page resources.

    The resource dictionary is used for inline-image color-space component lookup when an unfiltered inline image has no reliable declared length.

    PdfDocument::parse_content_view_with_resources

    Parse a content byte view with page resources.

    The input view is read directly; returned operators own any byte data they need to keep, such as text strings and inline-image data.

    PdfDocument::parse_coordinate

    Parse one coordinate pair using the default A4 page context.

    PdfDocument::parse_coordinate_rectangle

    Parse one coordinate rectangle. A leading ? treats the third and fourth numbers as absolute upper-right coordinates.

    PdfDocument::parse_coordinate_rectangles

    Parse one coordinate rectangle per page in the document.

    PdfDocument::parse_coordinate_tuple

    fn PdfDocument::parse_coordinate_tuple(self : PdfDocument, text : String) -> (Double, Double) raise
    PdfError

    Return cpdfcoord's tuple-shaped parse_coordinate result.

    PdfDocument::parse_coordinates

    Parse one coordinate pair per page in the document.

    PdfDocument::parse_coordinates_tuple

    fn PdfDocument::parse_coordinates_tuple(self : PdfDocument, text : String) -> Array[(Double, Double)] raise
    PdfError

    Return cpdfcoord's tuple-shaped parse_coordinates results.

    PdfDocument::parse_function

    Parse a PDF function object from this document.

    Supports PDF function types 0, 2, 3, and 4. Sampled and calculator functions are read from decoded stream data; interpolation and stitching functions are read from dictionaries. Raises for malformed dictionaries, invalid arities, stream decoding failures, or unsupported function types.

    PdfDocument::parse_matrix

    Read a transformation matrix from a dictionary entry.

    If key is absent, the identity matrix is returned. Present values must be arrays of six numbers in PDF matrix order [a b c d e f]; malformed arrays raise @core.PdfError::MatrixMalformed, and non-numeric entries raise @core.PdfError::NumberExpected.

    PdfDocument::parse_pagespec

    fn PdfDocument::parse_pagespec(self : PdfDocument, spec : String) -> Array[Int] raise
    PdfError

    Parse a cpdf page specification against this document.

    PdfDocument::parse_rectangle

    Parse and normalize a PDF rectangle array.

    The input must resolve to an array of four numeric objects. Coordinates are normalized so the result always has lower bounds in min_x/min_y and upper bounds in max_x/max_y. Non-array inputs raise @core.PdfError::RectangleExpected; malformed numeric entries raise @core.PdfError::BadRectangle.

    PdfDocument::parse_single_number

    fn PdfDocument::parse_single_number(self : PdfDocument, text : String) -> Double raise
    PdfError

    Parse a single numeric coordinate expression using the default A4 page context.

    PdfDocument::parse_units_string

    fn PdfDocument::parse_units_string(self : PdfDocument, page :
    PdfPage
    , text : String) -> Array[Double] raise
    PdfError

    Parse a coordinate expression with page-relative units and variables for the supplied page.

    PdfDocument::parsed_object_entries

    fn PdfDocument::parsed_object_entries(self : PdfDocument) -> Array[(Int, Int,
    PdfObject
    )]

    Return parsed document objects as sorted (number, generation, object) triples.

    PdfDocument::pdf_decode_stream

    Decode all supported filter stages from a stream object in this document.

    Indirect filter and decode-parameter objects are resolved through the document. Unsupported filters raise @core.PdfError::FilterNotSupported.

    PdfDocument::pdf_decode_stream_until_unknown

    Decode supported filter stages until the first unsupported filter.

    The unsupported filter and remaining filters stay in the stream dictionary; malformed supported filters still raise.

    PdfDocument::pdf_decode_streams_until_unknown

    fn PdfDocument::pdf_decode_streams_until_unknown(self : PdfDocument) -> Unit raise
    PdfError

    Decode supported filter stages on every parsed stream in the document.

    Streams already marked as decrypted stay in that state. Objects are updated in place and logged as altered when their stream data changes.

    PdfDocument::pdf_image_object_of_png_data

    Build a PDF image XObject for PNG data, adding an /SMask object to self when the PNG carries an alpha channel.

    PdfDocument::pdf_object_of_function

    fn PdfDocument::pdf_object_of_function(self : PdfDocument, function : PdfFunction) ->
    PdfObject

    Build a PDF object for a parsed function.

    Interpolation functions are written as dictionaries. Stitching functions add child function objects to this document and reference them from the returned dictionary. Sampled and calculator variants currently write only the common function dictionary fields and do not recreate their stream data.

    PdfDocument::pdf_of_pages

    fn PdfDocument::pdf_of_pages(self : PdfDocument, page_numbers : ArrayView[Int], retain_numbering? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    page_numbers are 1-based. Bookmarks, destinations, annotations, and page labels are repaired for the retained pages where possible. retain_numbering preserves original page-label numbering; process_struct_tree trims tagged structure references to deleted pages.

    PdfDocument::pdf_type_typeset

    fn PdfDocument::pdf_type_typeset(self : PdfDocument, process_struct_tree : Bool, lmargin : Double, rmargin : Double, tmargin : Double, bmargin : Double, paper :
    PaperSize
    , elements : ArrayView[PdfTypeElement]) -> PdfTypeTypesetResult raise
    PdfError

    Typeset cpdftype elements into PDF pages and per-page tag metadata.

    The input stream is numbered, laid out, and paginated before content operators are emitted. The supplied document is mutated only for font and annotation objects; callers can add the returned pages to a page tree.

    PdfDocument::permissions

    Decode the denied permissions from the document encryption dictionary.

    Unencrypted documents return an empty array. Encrypted documents parse /Encrypt and may raise if the encryption dictionary is malformed.

    PdfDocument::portfolio

    Build a PDF portfolio, also known as a PDF collection.

    The original document is left unchanged. mod_date can be supplied for deterministic output; otherwise the current cpdf-style date is used.

    PdfDocument::postpend_operators

    Append content operators to a page.

    Normal mode parses existing content and wraps it with graphics-state protection before appending ops. fast mode appends a protected new stream without parsing existing content.

    PdfDocument::prepend_operators

    Prepend content operators to a page.

    In normal mode existing content is parsed and merged into a single stream after ops. In fast mode a new stream is inserted before existing content without parsing the old streams.

    PdfDocument::presentation

    fn PdfDocument::presentation(self : PdfDocument, range : ArrayView[Int], transition : String?, delay : Double?, horizontal : Bool, inward : Bool, direction : Int, effect_duration : Double) -> PdfDocument raise
    PdfError

    Add presentation transition metadata to the selected 1-based page numbers.

    The accepted transition names match cpdf: Split, Blinds, Box, Wipe, Dissolve, and Glitter. Unknown names raise @core.PdfError::SoftError("Unknown presentation type").

    PdfDocument::print_font_table

    fn PdfDocument::print_font_table(self : PdfDocument, font_name : String, page_number : Int) -> Bytes raise
    PdfError

    Return the bytes cpdf's print_font_table would print.

    PdfDocument::print_fonts

    fn PdfDocument::print_fonts(self : PdfDocument, page_numbers : ArrayView[Int], json? : Bool) -> Bytes raise
    PdfError

    Return the bytes cpdf's print_fonts would print.

    PdfDocument::process_pages

    Apply a cpdf-style page callback to selected pages.

    The callback returns the replacement page, the page serial whose destinations should be transformed, and the transform matrix. Page numbers outside the document are ignored, matching cpdf's range-membership behavior.

    PdfDocument::process_xobjects

    Process Form XObjects referenced by a page resource dictionary.

    For each indirect /XObject with subtype /Form, process receives the document, page resources, and the form stream. It must return exactly one processed stream, which replaces the original form stream data.

    PdfDocument::read_annotation

    Read one annotation dictionary from this document.

    The annotation object may be direct or indirect. /Rect is required. Popup parents are resolved recursively up to a bounded depth to avoid cycles.

    PdfDocument::read_bookmarks

    Read the document outline tree as flattened bookmarks.

    When preserve_actions is false, actions with destinations are resolved to destinations where possible. When it is true, action dictionaries and named destinations are preserved more shallowly for round-tripping.

    PdfDocument::read_cid_system_info

    Read a CID-system-info dictionary.

    Registry and ordering are returned as byte strings, matching PDF string semantics. Missing or malformed required fields raise @core.PdfError.

    PdfDocument::read_cidkeyed_font

    Parse a Type 0 font dictionary into a CID-keyed font.

    This reads the descendant CIDFont, width data, descriptor, base font, and CMap encoding. External CMap streams are parsed when possible while still preserving the referenced stream object number.

    PdfDocument::read_colour_space

    Parse a colour-space object using the document and resource dictionary.

    The parser resolves resource colour-space names and supports device spaces, pattern spaces with a base space, calibrated Gray/RGB/Lab spaces, ICCBased spaces, Indexed spaces, Separation spaces, and DeviceN spaces. Unsupported or malformed colour spaces return None; malformed numeric fields may raise @core.PdfError.

    PdfDocument::read_destination

    Reads and normalizes a PDF destination object.

    When shallow is false, named and string destinations are resolved through the document catalog when possible. Unknown or malformed destination shapes are represented as DestNull.

    PdfDocument::read_encoding

    Read the simple-font encoding from a font dictionary.

    Name encodings are recognized directly. Encoding dictionaries combine /BaseEncoding and /Differences; TrueType encodings additionally fall back to StandardEncoding for undefined entries. Missing or unrecognized encodings use PdfImplicitInFontFile.

    PdfDocument::read_font

    Read any supported PDF font dictionary.

    The result is classified as standard 14, simple, or CID-keyed. A /ToUnicode stream, when present and parseable, is attached to the parsed font so extractors prefer explicit Unicode mappings.

    PdfDocument::read_font_descriptor

    Read the /FontDescriptor dictionary attached to a font.