pdflite

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

    pdf
    document
    parser
    writer
    Download zip
    Version
    0.3.0
    License
    Apache-2.0
    Last updated
    7 hours ago
    Downloads
    585

    #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 cpdfcontent blend 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 cpdfcontent's source-shaped gs ExtGState resource dictionary.

    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::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.

    Missing descriptors return None. Present descriptors are parsed tolerantly for optional numeric fields, while malformed required shapes such as an invalid /FontBBox still raise through the underlying object readers.

    PdfDocument::read_font_metrics

    Read normalized one-byte font metrics for a simple or Type 3 font.

    The result contains 256 entries when /Widths, /FirstChar, and /LastChar are present and well formed. Missing metrics return None; malformed bounds or width arrays raise the corresponding font error.

    PdfDocument::read_name_tree

    Read all entries from a PDF name tree as sorted byte-string keys.

    Malformed trees whose keys are not PdfString values return an empty array. Well-formed entries are sorted by byte order and duplicate keys are collapsed by the deduplication pass.

    PdfDocument::read_number_tree

    Read all entries from a PDF number tree as sorted integer keys.

    Malformed trees whose keys are not PdfInteger values return an empty array. Well-formed entries are sorted numerically and duplicate keys are collapsed by the deduplication pass.

    PdfDocument::read_optional_content_groups

    Read catalog /OCProperties from the document.

    Returns None when the catalog has no optional-content properties. When properties are present, OCG entries are returned with their indirect object numbers so callers can preserve or renumber references before writing.

    PdfDocument::read_page_labels

    Read the document catalog /PageLabels number tree.

    The returned start_page values are converted from PDF's zero-based page indexes to the public 1-based page numbering used by this module. Documents without page labels return an empty array.

    PdfDocument::read_simple_font

    Parse a simple-font dictionary.

    Supported subtypes are Type1, MMType1, Type3, and TrueType. The returned value includes optional descriptors, metrics, Type 3 CharProc data, and the resolved simple-font encoding.

    PdfDocument::read_standard14_font

    Read a standard 14 font dictionary.

    The dictionary must contain a recognized /BaseFont; its encoding is read with read_encoding so custom differences are preserved.

    PdfDocument::recompress

    Compress uncompressed streams, and streams using older lossless filters, with /FlateDecode.

    Metadata streams and encrypted documents are left unchanged. The source document is copied before mutation, matching the rest of the high-level pdflite editing APIs.

    PdfDocument::recrypt_with_password

    fn PdfDocument::recrypt_with_password(self : PdfDocument, password : BytesView) -> PdfDocument raise
    PdfError

    Re-encrypt a previously decrypted document using its saved ARC4 settings.

    The document must have saved encryption state from a successful decrypt. The supplied password is authenticated against that state before the original encryption dictionary shape is restored.

    PdfDocument::recrypt_with_password_aesv2

    fn PdfDocument::recrypt_with_password_aesv2(self : PdfDocument, password : BytesView) -> PdfDocument raise
    PdfError

    Re-encrypt a decrypted AESV2 document using native random IVs.

    The document must carry saved encryption state from a previous decrypt operation; password is used to recover the file key for re-encryption.

    PdfDocument::recrypt_with_password_aesv2_with_iv_provider

    fn PdfDocument::recrypt_with_password_aesv2_with_iv_provider(self : PdfDocument, password : BytesView, iv_provider : (Int, Int, Int) -> Bytes raise
    PdfError
    ) -> PdfDocument raise
    PdfError

    Re-encrypt a decrypted AESV2 document using its saved encryption settings.

    iv_provider supplies fresh IVs for encrypted object data. The saved encryption state determines passwords, permissions, and crypt-filter shape.

    PdfDocument::recrypt_with_password_aesv3

    fn PdfDocument::recrypt_with_password_aesv3(self : PdfDocument, password : BytesView) -> PdfDocument raise
    PdfError

    Re-encrypt a decrypted AESV3 document using native random IVs.

    The document must carry saved encryption state from a previous decrypt operation; password is used to recover the file key for re-encryption.

    PdfDocument::recrypt_with_password_aesv3_with_iv_provider

    fn PdfDocument::recrypt_with_password_aesv3_with_iv_provider(self : PdfDocument, password : BytesView, iv_provider : (Int, Int, Int) -> Bytes raise
    PdfError
    ) -> PdfDocument raise
    PdfError

    Re-encrypt a decrypted AESV3 document using its saved encryption settings.

    iv_provider supplies fresh IVs for encrypted object data. The saved encryption state supplies the existing AESV3 password entries and file key wrapping metadata.

    PdfDocument::rectify_boxes

    Rectify a page so its media-box origin is (0, 0).

    Known page boxes are shifted by the same amount, and page content, annotations, and pattern matrices receive the compensating translation.

    PdfDocument::redact_pages

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

    Redact whole selected pages by emptying their visible content.

    This ports cpdfpage's redact: selected pages keep their page geometry and rotation, but page content, resources, and /Annots are removed. When process_struct_tree is true, structure entries for the redacted pages are trimmed.

    PdfDocument::redact_path

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

    Return a copy of the document after applying cpdf's current path redaction.

    The upstream cpdfredact.redact implementation currently runs the page processor but does not rewrite page content, so this validates the selected page range and preserves the document.

    PdfDocument::referenced_object_numbers

    Returns sorted object numbers reachable from object.

    Indirect references are followed through the document. Dictionary keys in no_follow_entries are skipped, and dictionaries containing any no_follow_contains marker entry are not traversed.

    PdfDocument::remove_added_text

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

    Remove text added by cpdf add-text stamping from selected one-based pages.

    PdfDocument::remove_all_metadata

    Remove the catalog metadata entry and every parsed object whose /Type is /Metadata.

    PdfDocument::remove_all_text

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

    Remove all text-showing operators from selected one-based pages and their referenced Form XObjects.

    PdfDocument::remove_annotations

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

    Return a copy of the document with /Annots removed from selected pages.

    PdfDocument::remove_art

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

    Remove /ArtBox entries from selected pages.

    PdfDocument::remove_attached_files

    Remove document-level embedded files and page-level file attachment annotations.

    The original document is left unchanged. Non-file-attachment annotations are preserved.

    PdfDocument::remove_bleed

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

    Remove /BleedBox entries from selected pages.

    PdfDocument::remove_bookmarks

    Return a copy of the document with catalog /Outlines removed.

    The original document is not mutated; the returned document has a new root object and trailer root reference.

    PdfDocument::remove_chain

    Remove a nested value along a path rooted at the trailer dictionary.

    Returns true when an entry was removed and false when the path is absent. Empty chains raise @core.PdfError::DictionaryExpected. A single-key chain is treated as an invalid request when the key exists, preserving the trailer root rather than removing one of its direct entries.

    PdfDocument::remove_clipping

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

    Remove clipping paths from selected one-based pages and their Form XObjects.

    PdfDocument::remove_cropping

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

    Remove /CropBox entries from selected pages.

    PdfDocument::remove_dict_entry_everywhere

    Remove dictionary entries named key throughout parsed objects and trailer.

    When search is supplied, an entry is removed only when its resolved value equals search. Nested dictionaries, arrays, and stream dictionaries are traversed recursively; deferred document objects are left untouched.

    PdfDocument::remove_dict_entry_string

    fn PdfDocument::remove_dict_entry_string(self : PdfDocument, key : String, search? :
    PdfObject
    ?) -> Unit

    Compatibility wrapper matching cpdfutil's string-key remove_dict_entry.

    PdfDocument::remove_duplicate_fonts

    fn PdfDocument::remove_duplicate_fonts(self : PdfDocument) -> Unit

    Removes duplicate embedded font streams from this document.

    Streams are considered duplicates when both their dictionaries and decoded byte payloads match. References to duplicate streams are rewired to the first matching stream and duplicate objects are removed.

    PdfDocument::remove_embedded_fonts

    Return a copy of the document with embedded font-file references removed.

    This ports cpdf's remove_fonts: every parsed /Type /Font dictionary with a /FontDescriptor receives a new descriptor object with /FontFile, /FontFile2, and /FontFile3 removed. The original document and original descriptor objects are left untouched.

    PdfDocument::remove_javascript

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

    Empty /JS strings, empty lowercase javascript: URI strings, and remove the /Root /Names /JavaScript chain.

    PdfDocument::remove_metadata

    Remove the catalog /Metadata entry.

    PdfDocument::remove_object

    fn PdfDocument::remove_object(self : PdfDocument, number : Int) -> Unit

    Remove an object from the document and record a deletion event.

    PdfDocument::remove_object_by_spec

    fn PdfDocument::remove_object_by_spec(self : PdfDocument, spec : String) -> Unit raise
    PdfError

    Remove an object by decimal object number string.

    PdfDocument::remove_optional_content_groups

    fn PdfDocument::remove_optional_content_groups(self : PdfDocument) -> PdfDocument raise
    PdfError

    Return a copy of the document with catalog /OCProperties removed.

    The original document is not mutated; the returned document receives a new root object and trailer root reference.

    PdfDocument::remove_page_box

    Remove one page-box dictionary entry from selected pages.

    PdfDocument::remove_page_labels

    Return a copy of the document with catalog /PageLabels removed.

    The original document is not mutated; the returned document has a new root object and trailer root reference.

    PdfDocument::remove_pdfua_mark

    Return a copy of the document with PDF/UA XMP marker fields removed.

    PdfDocument::remove_struct_tree

    Remove the structure tree and marked-content structure operators.

    This ports cpdfpage's remove_struct_tree: /StructTreeRoot, /StructParent, and /StructParents entries are removed throughout the document, and marked-content structure delimiters are stripped from page streams and referenced Form XObjects.

    PdfDocument::remove_trim

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

    Remove /TrimBox entries from selected pages.

    PdfDocument::remove_unreferenced

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

    Remove objects that are no longer reachable from the trailer or root.

    References to deleted pages are first nulled from destinations and actions. The document is mutated in place.

    PdfDocument::renumber_objects

    fn PdfDocument::renumber_objects(self : PdfDocument, changes : ArrayView[(Int, Int)]) -> PdfDocument raise
    PdfError

    Return a copy of the document with object numbers remapped.

    changes maps old object numbers to new object numbers; omitted objects keep their original number. All indirect references, the root reference, trailer dictionary, and object-stream metadata are updated. Duplicate or nonpositive target numbers raise @core.PdfError::InvalidObjectNumber.

    PdfDocument::renumber_objects_by_offset

    fn PdfDocument::renumber_objects_by_offset(self : PdfDocument, offset : Int) -> PdfDocument raise
    PdfError

    Return a copy with every object number increased by offset.

    offset == 0 returns a plain copy. Negative offsets raise @core.PdfError::InvalidObjectNumber.

    PdfDocument::renumber_objects_compact

    Return a copy whose objects are numbered compactly from 1 in object order.

    PdfDocument::renumber_pages

    Rename page resources so every page has independent resource names.

    Content streams and inline-image dictionaries are rewritten to use the new names, and each page resource dictionary is updated. This returns new page records; the source document object table is not rewritten.

    PdfDocument::replace_chain

    Replace a value along a path rooted at the document trailer dictionary.

    Each name in chain selects a dictionary entry. Names of the form /[n] select array entries. Missing intermediate dictionary entries are created as nested dictionaries, and indirect intermediate objects are updated in the document object table. Raises when the chain is empty or when a non-container or invalid array position is encountered.

    PdfDocument::replace_dict_entry_everywhere

    Replace dictionary entries named key throughout parsed objects and trailer.

    Missing keys are ignored. When search is supplied, only entries whose resolved current value equals search are replaced.

    PdfDocument::replace_dict_entry_string

    fn PdfDocument::replace_dict_entry_string(self : PdfDocument, key : String, value :
    PdfObject
    , search? :
    PdfObject
    ?) -> Unit

    Compatibility wrapper matching cpdfutil's string-key replace_dict_entry.

    PdfDocument::replace_inherit

    fn PdfDocument::replace_inherit(self : PdfDocument, object_numbers : ArrayView[Int]) -> Unit raise
    PdfError

    Materialize inherited page attributes onto page dictionaries.

    For each object number, inherited /MediaBox, /CropBox, /Rotate, and /Resources values are copied onto the page object when available. This is useful before page extraction or object-level rewriting.

    PdfDocument::replace_object_by_spec

    fn PdfDocument::replace_object_by_spec(self : PdfDocument, spec : String, value :
    PdfObject
    ) -> Unit raise
    PdfError

    Replace an object using the cpdf object-spec grammar.

    PdfDocument::replace_stream_by_spec

    fn PdfDocument::replace_stream_by_spec(self : PdfDocument, spec : String, data : BytesView) -> Unit raise
    PdfError

    Replace a stream's bytes while preserving its dictionary except /Length.

    PdfDocument::replace_struct_tree

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

    Return a copy of the document with structure-tree objects replaced from JSON.

    PdfDocument::reveal_hidden_text

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

    Reveal hidden text on selected one-based pages and their Form XObjects.

    This ports the cpdftweak.ml reveal-hidden-text behavior by removing all Tr text rendering-mode operators from selected content streams.

    PdfDocument::revision_read

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

    Return the number of document revisions read from the input.

    PdfDocument::root

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

    Return the catalog root object number tracked on the document.

    PdfDocument::rotate_contents

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

    Rotate selected page contents around each page's /MediaBox center.

    This ports cpdfpage's rotate_contents: page boxes and /Rotate entries are left unchanged, while content streams, annotations, pattern matrices, and destination coordinates are transformed.

    PdfDocument::rotate_pages

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

    Set selected page /Rotate entries to an absolute rotation in degrees.

    PdfDocument::rotate_pages_by

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

    Add rotation degrees to selected page /Rotate entries.

    PdfDocument::rotate_pdf

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

    Compatibility method using cpdfpage's rotate_pdf name.

    PdfDocument::rotate_pdf_by

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

    Compatibility method using cpdfpage's rotate_pdf_by name.

    PdfDocument::scale_contents

    fn PdfDocument::scale_contents(self : PdfDocument, page_numbers : ArrayView[Int], position :
    PdfPosition
    , scale : Double, fast? : Bool) -> PdfDocument raise
    PdfError

    Scale selected page contents and annotations around a cpdf-style position.

    The transform origin is calculated from /CropBox when present, otherwise /MediaBox. Destination references for scaled pages are transformed with the same matrix.

    PdfDocument::scale_pages

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

    Scale selected pages by per-page x/y factors, including boxes and content.

    This ports cpdf's scale_pdf: selected page boxes, content streams, annotations, pattern matrices, and destination coordinates are transformed by a scale matrix around the origin.

    PdfDocument::scale_pdf

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

    Scale selected pages using cpdf's absolute page-indexed scale list.

    This mirrors cpdfpage's scale_pdf: scales[page - 1] is used for each selected page, and unselected pages are left untouched.

    PdfDocument::scale_to_fit_pages

    fn PdfDocument::scale_to_fit_pages(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], position? :
    PdfPosition
    , input_scale? : Double, fast? : Bool) -> PdfDocument raise
    PdfError

    Scale selected pages to fit target page sizes while preserving aspect ratio.

    PdfDocument::scale_to_fit_pdf

    fn PdfDocument::scale_to_fit_pdf(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], position? :
    PdfPosition
    , input_scale? : Double, fast? : Bool) -> PdfDocument raise
    PdfError

    Scale selected pages to fit using cpdf's absolute page-indexed size list.

    PdfDocument::scale_to_fit_rotate

    fn PdfDocument::scale_to_fit_rotate(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], rotation : Int, fast? : Bool) -> PdfDocument raise
    PdfError

    Conditionally rotate selected pages using cpdf's absolute page-indexed size list, then upright the same pages.

    PdfDocument::scale_to_fit_rotate_pages

    fn PdfDocument::scale_to_fit_rotate_pages(self : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], rotation : Int, fast? : Bool) -> PdfDocument raise
    PdfError

    Conditionally rotate selected pages to better fit target sizes, then upright the same pages.

    This ports cpdf's scale_to_fit_rotate: if a page and its target size have opposite orientation, the page dictionary rotation is adjusted by rotation; upright_pages is then applied to the selected range.

    PdfDocument::select_object_numbers

    fn PdfDocument::select_object_numbers(self : PdfDocument, predicate : (
    PdfObject
    ) -> Bool) -> Array[Int]

    Return parsed object numbers whose objects satisfy predicate.

    Deferred objects are not loaded by this helper. Results follow ascending object-number order.

    PdfDocument::set_annotations_json

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

    Return a copy of the document with cpdf annotation JSON appended.

    Existing objects are first renumbered above the imported annotation object range, matching cpdf's collision-avoidance strategy. Header rows and other nonpositive extra-object rows are ignored; positive extra objects are added before page annotations are rebuilt.

    PdfDocument::set_box_string

    fn PdfDocument::set_box_string(self : PdfDocument, page_numbers : ArrayView[Int], box_name : String, min_x : Double, max_x : Double, min_y : Double, max_y : Double) -> PdfDocument raise
    PdfError

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

    PdfDocument::set_first_xref

    fn PdfDocument::set_first_xref(self : PdfDocument, first_xref : Int) -> Unit

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

    PdfDocument::set_info_entry

    fn PdfDocument::set_info_entry(self : PdfDocument, key :
    PdfName
    , value :
    PdfObject
    , version : Int, keep_version? : Bool, xmp_also? : Bool, xmp_just_set? : Bool) -> PdfDocument raise
    PdfError

    Set or replace one /Info dictionary entry.

    PdfDocument::set_info_entry_string

    fn PdfDocument::set_info_entry_string(self : PdfDocument, entry : (String,
    PdfObject
    , Int), keep_version? : Bool, xmp_also? : Bool, xmp_just_set? : Bool) -> PdfDocument raise
    PdfError

    Set or replace one /Info entry from cpdf's string-key tuple form.

    PdfDocument::set_language

    fn PdfDocument::set_language(self : PdfDocument, language : BytesView) -> PdfDocument raise
    PdfError

    Set the catalog /Lang value.

    PdfDocument::set_language_string

    fn PdfDocument::set_language_string(self : PdfDocument, language : String) -> PdfDocument raise
    PdfError

    Set the catalog /Lang value from a cpdf-style string.

    PdfDocument::set_mediabox

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

    Compatibility alias for PdfDocument::set_mediaboxes.

    PdfDocument::set_mediaboxes

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

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

    boxes must contain one entry for every page in the document, matching cpdf's rectangle parser. page_numbers selects which page entries are applied, and each selected page uses boxes[page_number - 1].

    PdfDocument::set_metadata_date

    fn PdfDocument::set_metadata_date(self : PdfDocument, date : String) -> PdfDocument raise
    PdfError

    Set the XMP /Metadata stream's xmp:MetadataDate field.

    PdfDocument::set_metadata_from_bytes

    fn PdfDocument::set_metadata_from_bytes(self : PdfDocument, data : BytesView, keep_version? : Bool) -> PdfDocument raise
    PdfError

    Set the catalog metadata XML stream from in-memory bytes.

    PdfDocument::set_non_full_screen_page_mode

    fn PdfDocument::set_non_full_screen_page_mode(self : PdfDocument, mode : String) -> PdfDocument raise
    PdfError

    Set /ViewerPreferences /NonFullScreenPageMode.

    PdfDocument::set_open_action

    fn PdfDocument::set_open_action(self : PdfDocument, page_number : Int, fit? : Bool, destination? :
    PdfObject
    ?) -> PdfDocument raise
    PdfError

    Set the catalog /OpenAction to a GoTo action.

    page_number is one-based. When destination is supplied and starts with a page number integer, that integer is rewritten to the corresponding page indirect reference.

    PdfDocument::set_open_action_string_destination

    fn PdfDocument::set_open_action_string_destination(self : PdfDocument, page_number : Int, fit? : Bool, destination? : String?) -> PdfDocument raise
    PdfError

    Set the catalog /OpenAction from cpdf-style PDF destination syntax.

    PdfDocument::set_page_box

    fn PdfDocument::set_page_box(self : PdfDocument, page_numbers : ArrayView[Int], box_name :
    PdfName
    , min_x : Double, max_x : Double, min_y : Double, max_y : Double) -> PdfDocument raise
    PdfError

    Set a fixed named page box on selected pages.

    The scalar argument order mirrors cpdf's historical setBox: (min_x, max_x, min_y, max_y).

    PdfDocument::set_page_layout

    fn PdfDocument::set_page_layout(self : PdfDocument, layout : String) -> PdfDocument raise
    PdfError

    Set the catalog /PageLayout value using a name without the leading slash.

    PdfDocument::set_page_mode

    fn PdfDocument::set_page_mode(self : PdfDocument, mode : String) -> PdfDocument raise
    PdfError

    Set the catalog /PageMode value using a name without the leading slash.

    PdfDocument::set_revision_read

    fn PdfDocument::set_revision_read(self : PdfDocument, revision_read : Int) -> Unit

    Set the number of document revisions read from the input.

    PdfDocument::set_root

    fn PdfDocument::set_root(self : PdfDocument, root : Int) -> Unit

    Set the catalog root object number.

    PdfDocument::set_trailer_dict

    fn PdfDocument::set_trailer_dict(self : PdfDocument, trailer_dict :
    PdfObject
    ) -> Unit

    Replace the document trailer dictionary object.

    PdfDocument::set_version

    fn PdfDocument::set_version(self : PdfDocument, major : Int, minor : Int) -> Unit

    Set the PDF version stored on the document.

    PdfDocument::set_viewer_preference

    Set or replace one /ViewerPreferences dictionary entry.

    PdfDocument::set_viewer_preference_string

    Set one /ViewerPreferences entry from cpdf's string-key tuple form.

    PdfDocument::set_was_linearized

    fn PdfDocument::set_was_linearized(self : PdfDocument, was_linearized : Bool) -> Unit

    Set whether the source PDF was marked as linearized.

    PdfDocument::shift_boxes

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

    Shift /MediaBox and known page boxes by page-indexed offsets.

    This ports cpdf's shift_boxes: offsets are indexed by absolute page number and content streams, annotations, and destination coordinates are not moved.

    PdfDocument::shift_pages

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

    Shift selected page contents and annotations by per-page offsets.

    page_numbers are 1-based and offsets must contain one (dx, dy) pair for each selected page. Destination references for shifted pages are transformed with the same matrix.

    PdfDocument::shift_pdf

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

    Shift selected pages using cpdf's absolute page-indexed offset list.

    This mirrors cpdfpage's shift_pdf: offsets[page - 1] is used for each selected page, while unselected pages are left untouched.

    PdfDocument::shortest_unused_prefix

    fn PdfDocument::shortest_unused_prefix(self : PdfDocument) -> String

    Return the shortest ASCII prefix unused by page resource names.

    The prefix is suitable for add_prefix when merging pages from independent documents with potentially colliding resource names.

    PdfDocument::show_annotation_bounding_boxes

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

    Draw bounding boxes around annotations on selected one-based pages.

    This ports the implemented annotation-overlay part of CamlPDF's redaction helper. Each annotation rectangle is stroked in yellow, or light yellow when light is set, and appended through the existing page-content rewrite path.

    PdfDocument::show_bounding_boxes

    fn PdfDocument::show_bounding_boxes(self : PdfDocument, page_numbers : ArrayView[Int], shape? :
    PdfRectangle
    ?, light? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Draw bounding boxes around annotations and selected page-content objects.

    PdfDocument::show_page_boxes

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

    Draw coloured outlines for the standard page boxes on selected pages.

    This ports cpdf's show_boxes: /MediaBox, /CropBox, /ArtBox, /TrimBox, and /BleedBox are appended as artifact-marked stroked rectangles when present.

    PdfDocument::size_attached_files

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

    Return the total raw byte size of all embedded file attachment streams.

    PdfDocument::squeeze

    fn PdfDocument::squeeze(self : PdfDocument, page_data? : Bool) -> PdfDocument raise
    PdfError

    Remove duplicate non-page, non-annotation objects, rewrite references to the first matching object, and recompress eligible streams.

    When page_data is true, page content streams and referenced Form XObjects are parsed and serialized into normalized uncompressed streams when doing so will not rewrite shared page content streams.

    PdfDocument::stamp_as_xobject

    Stamp the first page of overlay into this document as a Form XObject.

    The returned name is the resource name added to each selected base page. The overlay page itself is not retained as a visible page; its content and resources are embedded in the new Form XObject. Existing bookmarks in the base document are preserved and retargeted to the rebuilt page tree.

    PdfDocument::stamp_pages

    fn PdfDocument::stamp_pages(self : PdfDocument, page_numbers : ArrayView[Int], overlay : PdfDocument, relative_to_box? :
    PdfName
    , position? :
    PdfPosition
    , topline? : Bool, midline? : Bool, fast? : Bool, scale_to_fit? : Bool, is_over? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Stamp the first page of overlay onto selected pages by merging content.

    PdfDocument::stamp_pages_string

    fn PdfDocument::stamp_pages_string(self : PdfDocument, page_numbers : ArrayView[Int], overlay : PdfDocument, relative_to_box : String, position? :
    PdfPosition
    , topline? : Bool, midline? : Bool, fast? : Bool, scale_to_fit? : Bool, is_over? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Stamp using cpdfpage's string page-box names.

    PdfDocument::stream_object_entries

    fn PdfDocument::stream_object_entries(self : PdfDocument) -> Array[(Int, Int,
    PdfStream
    )]

    Return parsed stream-object entries in object-number order.

    PdfDocument::stretch

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

    Stretch selected pages using cpdf's absolute page-indexed size list.

    PdfDocument::stretch_pages

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

    Stretch selected pages to target sizes without preserving aspect ratio.

    This ports cpdfpage's stretch: the current /CropBox when present, otherwise /MediaBox, determines the source width and height. Page boxes, content streams, annotations, pattern matrices, and destination coordinates are transformed by the computed x/y scale.

    PdfDocument::string_of_pagespec

    fn PdfDocument::string_of_pagespec(self : PdfDocument, pages : ArrayView[Int]) -> String raise
    PdfError

    Format selected document pages as a compact cpdf page specification.

    PdfDocument::struct_tree_json_blob

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

    Extract the PDF/UA structure-tree JSON as UTF-8 bytes.

    PdfDocument::struct_tree_text

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

    Render cpdf's printed PDF/UA structure tree as UTF-8 bytes.

    PdfDocument::target_of_page_number

    Build a fit destination for a 1-based page number.

    Out-of-range page numbers return DestNull.

    PdfDocument::test_extract_text

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

    Return cpdf's simple test text extraction bytes for selected 1-based pages.

    PdfDocument::test_matterhorn_json

    fn PdfDocument::test_matterhorn_json(self : PdfDocument, test_name : String) -> Json raise
    PdfError

    Return cpdf-style PDF/UA Matterhorn failures as JSON.

    The current migration covers content-marking checks 01-003, 01-004, 01-005, and 01-007, role-map checks 02-001, 02-003, and 02-004, XMP metadata and DisplayDocTitle checks 06-001 through 07-002, and structure syntax checks 09-004 through 09-008, character-code Unicode mapping check 10-001, natural-language top-level /Lang check 11-001 plus source-unimplemented language checks 11-002 through 11-006, structure-tree attribute checks 13-004, 15-003, 17-002, 17-003, 19-003, and 19-004, heading checks 14-002, 14-003, 14-006, and 14-007, optional-content configuration checks 20-001 through 20-003, embedded file-spec check 21-001, XFA dynamicRender check 25-001, encryption checks 26-001 and 26-002, annotation parent structure check 28-002, annotation contents-or-Alt check 28-004, source-compatible form-field no-op check 28-005, annotation subtype and tab-order checks 28-006 through 28-009, annotation structure-parent checks 28-010 and 28-011, link annotation contents check 28-012, media-clip checks 28-014 and 28-015, file-attachment no-op 28-016, PrinterMark object and appearance checks 28-017 and 28-018, plus reference-XObject checks 30-001 and 30-002, plus font CIDSystemInfo/CIDToGIDMap/CMap checks 31-001 through 31-009, and source-unimplemented font-file checks 31-011 through 31-016, 31-018, and 31-030, plus TrueType encoding dictionary and cmap checks 31-017 and 31-019 through 31-026, and ToUnicode presence/value checks 31-027 through 31-029. Passing "" runs the covered subset; unsupported individual test names raise a soft error until their source checks are ported.

    PdfDocument::test_matterhorn_text

    fn PdfDocument::test_matterhorn_text(self : PdfDocument, test_name : String) -> Bytes raise
    PdfError

    Return cpdf-style text lines for the covered Matterhorn failures.

    PdfDocument::text_extractor_of_font

    Read a font dictionary and return a text extractor for it.

    PdfDocument::thin_lines

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

    Set a minimum line width on selected one-based pages.

    Passing a negative width sets the corresponding maximum line width, as in cpdf's thinlines implementation.

    PdfDocument::to_repr

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

    PdfDocument::toc_add_bookmark

    fn PdfDocument::toc_add_bookmark(self : PdfDocument, title : BytesView) -> PdfDocument raise
    PdfError

    Prepend the generated table-of-contents bookmark.

    Existing bookmarks are preserved at their current levels and order. The new bookmark targets the first page of the current document, which should be the first inserted TOC page after toc_insert_pages.

    PdfDocument::toc_insert_pages

    Prepend already-typeset TOC pages and shift existing page labels.

    Page references in destinations, annotations, open actions, and bookmarks are rewritten from original one-based page serials to their new serials after the inserted TOC pages.

    PdfDocument::toc_type_elements

    fn PdfDocument::toc_type_elements(self : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, dotleader : Bool, process_struct_tree : Bool, labels : ArrayView[
    PdfPageLabel
    ], bookmarks : ArrayView[
    PdfBookmark
    ], page_width : Double, margin : Double) -> Array[PdfTypeElement] raise
    PdfError

    Build the cpdftype element stream for a table of contents.

    page_width and margin are the already-resolved first-page dimensions from cpdftoc's caller. Actual page typesetting and insertion remain a separate step.

    PdfDocument::toc_typeset_pages

    fn PdfDocument::toc_typeset_pages(self : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, dotleader : Bool, process_struct_tree : Bool, labels : ArrayView[
    PdfPageLabel
    ], bookmarks : ArrayView[
    PdfBookmark
    ]) -> PdfTypeTypesetResult raise
    PdfError

    Typeset a TOC element stream into pages using cpdftoc's first-page geometry.

    The first page's /MediaBox defines the paper size and base margin, while an inherited /CropBox, when present, narrows the content width, offsets the margins, and is copied onto the generated TOC pages. This helper does not insert the pages into the source document.

    PdfDocument::toc_used_codepoints

    Return the unique Unicode codepoints cpdftoc needs before embedding a font.

    The scan includes the dot used by ellipses/leaders, the TOC title, bookmark titles, and the visible page-label text for each bookmark target. The returned order is first occurrence for deterministic callers and tests.

    PdfDocument::toc_with_fontpack

    fn PdfDocument::toc_with_fontpack(self : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, bookmark? : Bool, dotleader? : Bool) -> PdfDocument raise
    PdfError

    Add a table of contents using an already prepared font pack.

    This composes the non-structure-tree cpdftoc path: read existing bookmarks and labels, typeset TOC pages, prepend them, shift page labels, and optionally add the generated TOC bookmark. Documents without bookmarks are returned unchanged.

    PdfDocument::toc_with_source

    fn PdfDocument::toc_with_source(self : PdfDocument, source : PdfTocFontSource, font_size : Double, title : BytesView, bookmark? : Bool, dotleader? : Bool) -> PdfDocument raise
    PdfError

    Add a table of contents using a cpdftoc font source.

    Existing named fonts are rejected for TOCs, matching cpdf. Embeddable TrueType font sources will be handled by a later embedding slice.

    PdfDocument::trailer_dict

    Return the current trailer dictionary object.

    The returned object may share mutable container state with the document.

    PdfDocument::transform_annotations

    Transform annotation geometry referenced by a page dictionary.

    Applies matrix to /Rect, /QuadPoints, and /L entries. Indirect annotations are updated in this document; direct annotation dictionaries in the page's /Annots array are updated in place.

    PdfDocument::transform_bookmark

    Transform a bookmark destination by a matrix.

    Only the destination is changed; level, text, open state, colour, and flags are preserved.

    PdfDocument::transform_destination

    Applies a page transform matrix to destination coordinates.

    Only destinations tied to page objects are transformed. Named destinations, string destinations, non-page-number actions, and already page-number-based targets are preserved.

    PdfDocument::transform_quadpoints

    Transform PDF annotation quadpoints in groups of eight coordinates.

    Each complete group is interpreted as four (x, y) pairs and transformed by matrix. A complete group containing a non-numeric value is preserved unchanged, as is any trailing partial group. Non-array inputs are returned unchanged.

    PdfDocument::transform_rect

    Transform a rectangle and return the bounding PDF rectangle array.

    All four corners are transformed with matrix, then the axis-aligned bounds of those transformed points are written as [minX minY maxX maxY].

    PdfDocument::trim_marks

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

    Add trim marks around /TrimBox on selected pages.

    Pages without a valid /TrimBox are left unchanged, matching cpdf's trim_marks.

    PdfDocument::trim_structure_tree

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

    Trim structure-tree entries that point to pages outside the selected pages.

    page_numbers uses the same page-selection numbering as the page helpers. The document is mutated in place by deleting structure objects tied to removed pages and pruning /K arrays that reference them.

    PdfDocument::twoup

    fn PdfDocument::twoup(self : PdfDocument, fast? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Legacy cpdf two-up operation.

    This scales source pages down, imposes them 2x1, rotates/uprights the imposed sheets, then scales each sheet back to the first page's original size.

    PdfDocument::twoup_stack

    fn PdfDocument::twoup_stack(self : PdfDocument, fast? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Legacy cpdf two-up stack operation.

    This first imposes source pages in a 2x1 non-fit grid, then rotates the imposed sheets by -90 degrees and uprights them into ordinary page geometry.

    PdfDocument::typeset_table_of_contents

    fn PdfDocument::typeset_table_of_contents(self : PdfDocument, source : PdfTocFontSource, font_size : Double, title : BytesView, bookmark : Bool, dotleader : Bool, process_struct_tree : Bool, subformat? : PdfUASubformat?) -> PdfDocument raise
    PdfError

    Source-spelled high-level cpdftoc wrapper for non-structured TOC output.

    The structured/PDF-UA table-of-contents path still needs full source-tree preservation, so this wrapper rejects that mode instead of dropping existing structure entries.

    PdfDocument::upright

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

    Compatibility alias for PdfDocument::upright_pages.

    PdfDocument::upright_pages

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

    Remove page dictionary rotation from selected pages by transforming page data.

    Page content, annotations, known page boxes, and destinations are transformed into an upright coordinate system. Non-zero /MediaBox origins are shifted back to (0, 0) after rotation.

    PdfDocument::version

    fn PdfDocument::version(self : PdfDocument) -> (Int, Int)

    Return the PDF version as (major, minor).

    PdfDocument::vflip_pdf

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

    Compatibility method using cpdfpage's vflip_pdf name.

    PdfDocument::viewer_preference_item

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

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

    PdfDocument::viewer_preference_item_string

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

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

    PdfDocument::was_linearized

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

    Return whether the source PDF was marked as linearized.

    PdfDocument::what_encryption

    Return the document encryption method, or None for unencrypted documents.

    Unknown or unsupported encryption dictionaries may also return None after the dictionary has been parsed.

    PdfDocument::write_colour_space

    Serialize a colour space for writing into a PDF object graph.

    This delegates to pdf_object_of_colour_space and returns PdfNull when the parsed colour space is not representable as a valid PDF object.

    PdfDocument::write_encoding

    fn PdfDocument::write_encoding(self : PdfDocument, encoding : PdfEncoding) -> Int raise
    PdfError

    Write a custom encoding dictionary and return its object number.

    Currently this supports /Differences over an implicit base encoding, which is the form needed by the font writer. Unsupported encodings raise @core.PdfError::EncodingWriteUnsupported.

    PdfDocument::write_font

    fn PdfDocument::write_font(self : PdfDocument, font : PdfFont, objnum? : Int?) -> Int raise
    PdfError

    Write a parsed font into the document and return its object number.

    Standard fonts, Type 3 fonts with descriptors, and TrueType fonts with descriptors are supported. A TrueType descriptor may carry a /FontFile2 or omit it: omitting one writes a non-embedded font the consumer substitutes, whose /Widths still govern spacing. objnum can force the destination object number for rewrite workflows. CID-keyed fonts are written as a /Type0 root over a /CIDFontType2 descendant. Remaining unsupported shapes raise @core.PdfError::FontWriteUnsupported.

    PdfDocument::write_optional_content_groups

    Return a copy of the document with catalog /OCProperties replaced.

    OCG dictionaries are written using the object numbers stored in optional_content.ocgs. Configuration dictionaries are added as new objects, and the original document is left unchanged.

    PdfDocument::write_page_labels

    Return a copy of the document with catalog /PageLabels replaced.

    Public start_page values are written as zero-based PDF number-tree keys. Passing an empty label list removes any existing page-label tree.

    PdfDocument::xmp_info

    Return XMP metadata corresponding to a legacy /Info key.

    PdfDocument::xmp_info_blob

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

    Return cpdf-style XMP metadata report fields as stdout-style UTF-8 bytes.

    PdfDocument::xmp_info_json

    Return cpdf-style XMP metadata report fields as JSON.

    PdfDocument::xmp_info_json_blob

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

    Return cpdf-style XMP metadata report fields as UTF-8 JSON bytes.

    PdfDocument::xmp_info_string

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

    Return XMP metadata corresponding to a cpdf-style slash-prefixed string key.

    PdfDrawControl

    pub struct PdfDrawControl {
    frames : Array[PdfDrawControlFrame]
    xobject_bbox :
    PdfCoordRectangle

    font_name : String
    font_size : Double
    fontpack : PdfFontPack?
    fontpack_initialized : Bool
    paragraph_indent : Double?
    role_map : String
    auto_artifacts : Bool
    } derive(Eq, ToJson,
    Debug
    )

    Stateful builder for cpdf draw-control operations.

    This ports the frame-stack behavior from cpdfdrawcontrol.ml: ordinary operations are appended to the current frame; text sections, pushed graphics groups, and form XObjects collect nested operations and collapse them into TextSection, Qq, and FormXObject operations when closed.

    PdfDrawControl::add_bezier

    fn PdfDrawControl::add_bezier(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a cubic Bezier segment parsed from six numbers.

    PdfDrawControl::add_bezier13

    fn PdfDrawControl::add_bezier13(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a Bezier segment with the second control point inferred.

    PdfDrawControl::add_bezier23

    fn PdfDrawControl::add_bezier23(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a Bezier segment with the first control point inferred.

    PdfDrawControl::add_char_space

    fn PdfDrawControl::add_char_space(self : PdfDrawControl, spacing : Double) -> Unit raise
    PdfError

    Append a character-spacing operation.

    PdfDrawControl::add_circle

    fn PdfDrawControl::add_circle(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a circular path approximation parsed from center and radius.

    PdfDrawControl::add_default_fontpack

    fn PdfDrawControl::add_default_fontpack(self : PdfDrawControl, font_name : String) -> Unit raise
    PdfError

    Append the current font pack once under font_name.

    This ports cpdfdrawcontrol.ml's add_default_fontpack fontname helper. Calling set_fontpack resets the one-shot guard.

    PdfDrawControl::add_element_info

    Append structure element metadata for key.

    PdfDrawControl::add_image

    fn PdfDrawControl::add_image(self : PdfDrawControl, name : String) -> Unit raise
    PdfError

    Append an image-resource reference by name.

    PdfDrawControl::add_jpeg2000_data

    fn PdfDrawControl::add_jpeg2000_data(self : PdfDrawControl, name : String, data : BytesView) -> Unit raise
    PdfError

    Append a JPEG2000 image XObject operation from supplied image bytes.

    This ports the data-supplied branch of cpdfdrawcontrol.ml's addjpeg2000.

    PdfDrawControl::add_jpeg_data

    fn PdfDrawControl::add_jpeg_data(self : PdfDrawControl, name : String, data : BytesView) -> Unit raise
    PdfError

    Append a JPEG image XObject operation from supplied image bytes.

    This ports the data-supplied branch of cpdfdrawcontrol.ml's addjpeg.

    PdfDrawControl::add_leading

    fn PdfDrawControl::add_leading(self : PdfDrawControl, leading : Double) -> Unit raise
    PdfError

    Append a text-leading operation.

    PdfDrawControl::add_line

    fn PdfDrawControl::add_line(self : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Append a straight line segment parsed from document coordinates.

    PdfDrawControl::add_namespace

    fn PdfDrawControl::add_namespace(self : PdfDrawControl, namespace_name : String) -> Unit raise
    PdfError

    Append a structure namespace declaration.

    PdfDrawControl::add_new_page

    Append a new-page operation to the current frame.

    PdfDrawControl::add_newline

    Append a text-newline operation.

    PdfDrawControl::add_op

    Append one operation to the current frame.

    PdfDrawControl::add_opacity

    fn PdfDrawControl::add_opacity(self : PdfDrawControl, opacity : Double) -> Unit raise
    PdfError

    Append a fill-opacity operation.

    PdfDrawControl::add_para

    fn PdfDrawControl::add_para(self : PdfDrawControl, document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Append one paragraph text operation parsed from a cpdf paragraph spec.

    PdfDrawControl::add_paras

    fn PdfDrawControl::add_paras(self : PdfDrawControl, document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Append a multi-line paragraph operation parsed from a cpdf paragraph spec.

    PdfDrawControl::add_png_data

    fn PdfDrawControl::add_png_data(self : PdfDrawControl, document : PdfDocument, name : String, data : BytesView) -> Unit raise
    PdfError

    Append a PNG image XObject operation from supplied image bytes.

    document is used when the PNG needs an alpha-mask object, matching cpdfdrawcontrol.ml's addpng pdf ?data boundary.

    PdfDrawControl::add_rect

    fn PdfDrawControl::add_rect(self : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Append a rectangle path operation parsed from document coordinates.

    PdfDrawControl::add_render_mode

    fn PdfDrawControl::add_render_mode(self : PdfDrawControl, mode : Int) -> Unit raise
    PdfError

    Append a text rendering-mode operation.

    PdfDrawControl::add_rise

    fn PdfDrawControl::add_rise(self : PdfDrawControl, rise : Double) -> Unit raise
    PdfError

    Append a text-rise operation.

    PdfDrawControl::add_special_text

    fn PdfDrawControl::add_special_text(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append special text inside the current text section.

    PdfDrawControl::add_stroke_opacity

    fn PdfDrawControl::add_stroke_opacity(self : PdfDrawControl, opacity : Double) -> Unit raise
    PdfError

    Append a stroke-opacity operation.

    PdfDrawControl::add_structure_tag

    fn PdfDrawControl::add_structure_tag(self : PdfDrawControl, tag : String) -> Unit raise
    PdfError

    Append a structure-tag begin operation to the current frame.

    PdfDrawControl::add_tag

    fn PdfDrawControl::add_tag(self : PdfDrawControl, tag : String) -> Unit raise
    PdfError

    Append a marked-content tag operation to the current frame.

    PdfDrawControl::add_text

    fn PdfDrawControl::add_text(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append literal text inside the current text section.

    PdfDrawControl::add_text_scale

    fn PdfDrawControl::add_text_scale(self : PdfDrawControl, scale : Double) -> Unit raise
    PdfError

    Append a horizontal text-scale operation.

    PdfDrawControl::add_to

    fn PdfDrawControl::add_to(self : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Append a path move operation parsed from document coordinates.

    PdfDrawControl::add_word_space

    fn PdfDrawControl::add_word_space(self : PdfDrawControl, spacing : Double) -> Unit raise
    PdfError

    Append a word-spacing operation.

    PdfDrawControl::auto_artifacts

    fn PdfDrawControl::auto_artifacts(self : PdfDrawControl) -> Bool

    Return whether automatic artifact wrapping is enabled on this state.

    PdfDrawControl::begin_artifact

    Append an artifact begin operation for structured PDF output.

    PdfDrawControl::begin_text_section

    fn PdfDrawControl::begin_text_section(self : PdfDrawControl) -> Unit

    Start a text-section frame.

    PdfDrawControl::clip

    Append a clip operation using the current path.

    PdfDrawControl::clip_even_odd

    Append an even-odd clip operation using the current path.

    PdfDrawControl::close_path

    Append a close-path operation.

    PdfDrawControl::current_frame_name

    fn PdfDrawControl::current_frame_name(self : PdfDrawControl) -> String raise
    PdfError

    Return the current frame name.

    PdfDrawControl::current_ops

    Return a copy of the operations collected in the current frame.

    PdfDrawControl::depth

    fn PdfDrawControl::depth(self : PdfDrawControl) -> Int

    Return the current stack depth.

    PdfDrawControl::end_artifact

    Append an artifact end operation for structured PDF output.

    PdfDrawControl::end_element_info

    fn PdfDrawControl::end_element_info(self : PdfDrawControl, key : String) -> Unit raise
    PdfError

    Append the end marker for structure element metadata keyed by key.

    PdfDrawControl::end_structure_tag

    Append a structure-tag end operation to the current frame.

    PdfDrawControl::end_tag

    Append a marked-content tag end operation to the current frame.

    PdfDrawControl::end_text_section

    Finish the current text-section frame and append a PdfDrawTextSection op.

    PdfDrawControl::end_xobject

    Finish the current form XObject and append a PdfDrawFormXObject op.

    PdfDrawControl::equal

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

    PdfDrawControl::fill

    Append a fill operation for the current path.

    PdfDrawControl::fill_even_odd

    Append an even-odd fill operation for the current path.

    PdfDrawControl::font_name

    fn PdfDrawControl::font_name(self : PdfDrawControl) -> String

    Return the current draw-control font name.

    This is the per-instance counterpart of cpdfdrawcontrol.ml's getfontname callback.

    PdfDrawControl::font_size

    fn PdfDrawControl::font_size(self : PdfDrawControl) -> Double

    Return the current draw-control font size.

    This is the per-instance counterpart of cpdfdrawcontrol.ml's getfontsize callback.

    PdfDrawControl::fontpack_initialized

    fn PdfDrawControl::fontpack_initialized(self : PdfDrawControl) -> Bool

    Return whether the current font pack has been emitted once.

    This exposes the per-instance state corresponding to cpdf's fontpack_initialised ref.

    PdfDrawControl::matrix_rotate

    fn PdfDrawControl::matrix_rotate(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a rotation matrix operation parsed from a cpdf argument.

    PdfDrawControl::matrix_scale

    fn PdfDrawControl::matrix_scale(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a scale matrix operation parsed from a cpdf argument.

    PdfDrawControl::matrix_shear_x

    fn PdfDrawControl::matrix_shear_x(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append an X-shear matrix operation parsed from a cpdf argument.

    PdfDrawControl::matrix_shear_y

    fn PdfDrawControl::matrix_shear_y(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a Y-shear matrix operation parsed from a cpdf argument.

    PdfDrawControl::matrix_translate

    fn PdfDrawControl::matrix_translate(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a translation matrix operation parsed from a cpdf argument.

    PdfDrawControl::not_equal

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

    PdfDrawControl::ops

    Return a copy of the operations collected in the main frame.

    PdfDrawControl::paragraph_indent

    fn PdfDrawControl::paragraph_indent(self : PdfDrawControl) -> Double?

    Return the current paragraph indent used by add_paras.

    This is the per-instance counterpart of cpdfdrawcontrol.ml's getindent callback.

    PdfDrawControl::pop_group

    Finish the current pushed graphics-state frame and append a PdfDrawQq op.

    PdfDrawControl::push_group

    fn PdfDrawControl::push_group(self : PdfDrawControl) -> Unit

    Start a pushed graphics-state frame.

    PdfDrawControl::role_map

    fn PdfDrawControl::role_map(self : PdfDrawControl) -> String

    Return the role-map body configured on this draw-control state.

    PdfDrawControl::set_auto_artifacts

    fn PdfDrawControl::set_auto_artifacts(self : PdfDrawControl, enabled : Bool) -> Unit

    Enable or disable automatic artifact wrapping for structured draw output.

    PdfDrawControl::set_auto_tag

    fn PdfDrawControl::set_auto_tag(self : PdfDrawControl, enabled : Bool) -> Unit raise
    PdfError

    Append an automatic-structure-tag toggle operation.

    PdfDrawControl::set_dash_pattern

    fn PdfDrawControl::set_dash_pattern(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a dash-pattern operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_fill

    fn PdfDrawControl::set_fill(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a fill colour operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_font

    fn PdfDrawControl::set_font(self : PdfDrawControl, font_name : String, font_size : Double) -> Unit

    Set the font name and size used by subsequent text operations.

    PdfDrawControl::set_font_name

    fn PdfDrawControl::set_font_name(self : PdfDrawControl, font_name : String) -> Unit

    Set the font name used by subsequent text operations.

    PdfDrawControl::set_font_size

    fn PdfDrawControl::set_font_size(self : PdfDrawControl, font_size : Double) -> Unit

    Set the font size used by subsequent text operations.

    PdfDrawControl::set_fontpack

    fn PdfDrawControl::set_fontpack(self : PdfDrawControl, fontpack : PdfFontPack?) -> Unit

    Set the optional font pack emitted before subsequent text operations.

    PdfDrawControl::set_line_cap

    fn PdfDrawControl::set_line_cap(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a line-cap operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_line_join

    fn PdfDrawControl::set_line_join(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a line-join operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_line_thickness

    fn PdfDrawControl::set_line_thickness(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a line-thickness operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_matrix

    fn PdfDrawControl::set_matrix(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append an explicit transformation matrix parsed from six numbers.

    PdfDrawControl::set_miter_limit

    fn PdfDrawControl::set_miter_limit(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a miter-limit operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_paragraph_indent

    fn PdfDrawControl::set_paragraph_indent(self : PdfDrawControl, indent : Double?) -> Unit

    Set the paragraph indent used by paragraph text helpers.

    PdfDrawControl::set_role_map

    fn PdfDrawControl::set_role_map(self : PdfDrawControl, role_map : String) -> Unit

    Set the role-map body used by structured draw output.

    The value follows cpdf's -rolemap convention: pass entries such as "/H1 /H /Aside /Div" without the surrounding << >>.

    PdfDrawControl::set_stroke

    fn PdfDrawControl::set_stroke(self : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Append a stroke colour operation parsed from a cpdf draw-control argument.

    PdfDrawControl::set_xobject_bbox

    Set the bounding box used for the next closed form XObject.

    PdfDrawControl::set_xobject_bbox_from_string

    fn PdfDrawControl::set_xobject_bbox_from_string(self : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Parse and set the bounding box used for the next closed form XObject.

    This ports cpdfdrawcontrol.ml's xobjbbox command helper.

    PdfDrawControl::start_xobject

    fn PdfDrawControl::start_xobject(self : PdfDrawControl, name : String) -> Unit

    Start collecting a named form XObject.

    PdfDrawControl::stroke

    Append a stroke operation for the current path.

    PdfDrawControl::stroke_fill

    Append a fill-and-stroke operation for the current path.

    PdfDrawControl::stroke_fill_even_odd

    fn PdfDrawControl::stroke_fill_even_odd(self : PdfDrawControl) -> Unit raise
    PdfError

    Append an even-odd fill-and-stroke operation for the current path.

    PdfDrawControl::to_json

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

    PdfDrawControl::to_repr

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

    PdfDrawControl::use_xobject

    fn PdfDrawControl::use_xobject(self : PdfDrawControl, name : String) -> Unit raise
    PdfError

    Append a reference to a previously defined XObject.

    PdfDrawControlFrame

    pub(all) struct PdfDrawControlFrame {
    name : String
    ops : Array[PdfDrawOp]
    } derive(Eq, ToJson,
    Debug
    )

    Named frame of draw operations used by PdfDrawControl while nesting.

    PdfDrawControlFrame::equal

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

    PdfDrawControlFrame::not_equal

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

    PdfDrawControlFrame::to_json

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

    PdfDrawControlFrame::to_repr

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

    PdfDrawExtGStateResource

    pub(all) struct PdfDrawExtGStateResource {
    kind :
    PdfName

    value : Double
    name :
    PdfName

    } derive(Eq, ToJson,
    Debug
    )

    External graphics-state resource allocated while rendering draw operations.

    PdfDrawExtGStateResource::equal

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

    PdfDrawExtGStateResource::not_equal

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

    PdfDrawExtGStateResource::to_json

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

    PdfDrawExtGStateResource::to_repr

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

    PdfDrawFontPackState

    pub(all) struct PdfDrawFontPackState {
    identifier : String
    fontpack : PdfFontPack
    } derive(Eq, ToJson,
    Debug
    )

    Current font-pack binding used by draw rendering state.

    PdfDrawFontPackState::equal

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

    PdfDrawFontPackState::not_equal

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

    PdfDrawFontPackState::to_json

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

    PdfDrawFontPackState::to_repr

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

    PdfDrawFontResource

    pub(all) struct PdfDrawFontResource {
    identifier : String
    font_index : Int
    resource_name :
    PdfName

    object_number : Int
    } derive(Eq, ToJson,
    Debug
    )

    Font resource tracked while rendering draw operations.

    PdfDrawFontResource::equal

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

    PdfDrawFontResource::not_equal

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

    PdfDrawFontResource::to_json

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

    PdfDrawFontResource::to_repr

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

    PdfDrawJustification

    pub(all) enum PdfDrawJustification {
    PdfDrawLeft
    PdfDrawRight
    PdfDrawCentre
    } derive(Eq, ToJson,
    Debug
    )

    Paragraph justification used by cpdf draw operations.

    PdfDrawJustification::equal

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

    PdfDrawJustification::not_equal

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

    PdfDrawJustification::to_json

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

    PdfDrawJustification::to_repr

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

    PdfDrawOp

    pub(all) enum PdfDrawOp {
    PdfDrawRect(Double, Double, Double, Double)
    PdfDrawBezier(Double, Double, Double, Double, Double, Double)
    PdfDrawBezier23(Double, Double, Double, Double)
    PdfDrawBezier13(Double, Double, Double, Double)
    PdfDrawTo(Double, Double)
    PdfDrawLine(Double, Double)
    PdfDrawClosePath
    PdfDrawSetFill(
    PdfDrawColour
    )
    PdfDrawSetStroke(
    PdfDrawColour
    )
    PdfDrawSetLineThickness(Double)
    PdfDrawSetLineCap(Int)
    PdfDrawSetLineJoin(Int)
    PdfDrawSetMiterLimit(Double)
    PdfDrawSetDashPattern(Array[Double], Double)
    PdfDrawMatrix(
    TransformMatrix
    )
    PdfDrawQq(Array[PdfDrawOp])
    PdfDrawFill
    PdfDrawFillEvenOdd
    PdfDrawStroke
    PdfDrawFillStroke
    PdfDrawFillStrokeEvenOdd
    PdfDrawClip
    PdfDrawClipEvenOdd
    PdfDrawFormXObject(Double, Double, Double, Double, String, Array[PdfDrawOp])
    PdfDrawUse(String)
    PdfDrawImageXObject(String,
    PdfObject
    )
    PdfDrawImage(String)
    PdfDrawNewPage
    PdfDrawOpacity(Double)
    PdfDrawSOpacity(Double)
    PdfDrawFontPack(String, PdfFontPack, Array[Int])
    PdfDrawFont(String, Double)
    PdfDrawTextSection(Array[PdfDrawOp])
    PdfDrawText(String)
    PdfDrawSpecialText(String)
    PdfDrawPara(Double?, PdfDrawJustification, Double, Array[String])
    PdfDrawNewline
    PdfDrawLeading(Double)
    PdfDrawCharSpace(Double)
    PdfDrawWordSpace(Double)
    PdfDrawTextScale(Double)
    PdfDrawRenderMode(Int)
    PdfDrawRise(Double)
    PdfDrawTag(String)
    PdfDrawEndTag
    PdfDrawSTag(String)
    PdfDrawEndSTag
    PdfDrawBeginArtifact
    PdfDrawEndArtifact
    PdfDrawNamespace(String)
    PdfDrawEltInfo(String,
    PdfObject
    )
    PdfDrawEndEltInfo(String)
    PdfDrawAutoTag(Bool)
    } derive(Eq, ToJson,
    Debug
    )

    Source-level cpdf draw operation.

    This mirrors the operation shape from cpdfdraw.ml. The first rendering slice converts path, graphics-state, colour, matrix, and paint operations to @content.PdfContentOp; structure and page-level operations are represented here and will be rendered by later cpdfdraw slices.

    PdfDrawOp::debug_name

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

    Return the cpdf diagnostic spelling for one draw operation.

    PdfDrawOp::equal

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

    PdfDrawOp::not_equal

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

    PdfDrawOp::to_content_ops

    Convert one cpdf draw operation to flat PDF content operators.

    The currently ported rendering subset covers the direct operator mappings in the front of cpdfdraw.ml's ops_of_drawop: graphics state, matrix, path, colour, paint, clip, q/Q grouping, resource-backed XObjects, fontpack text, and paragraph layout. Later slices will fill in tagged-content and page-level rendering.

    PdfDrawOp::to_content_ops_with_context

    Convert one cpdf draw operation using resource state and special-text data.

    PdfDrawOp::to_content_ops_with_document

    Convert one cpdf draw operation using resource state and a document for indirect object allocation.

    PdfDrawOp::to_content_ops_with_document_context

    Convert one cpdf draw operation using document resources and special-text data.

    PdfDrawOp::to_content_ops_with_state

    Convert one cpdf draw operation using resource allocation state.

    PdfDrawOp::to_json

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

    PdfDrawOp::to_repr

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

    PdfDrawRenderState

    pub(all) struct PdfDrawRenderState {
    resource_number : Int
    marked_content_id : Int
    extgstates : Array[PdfDrawExtGStateResource]
    xobjects : Array[PdfDrawXObjectResource]
    form_xobjects : Array[PdfDrawXObjectResource]
    fonts : Array[PdfDrawFontResource]
    fontpacks : Array[PdfDrawFontPackState]
    current_fontpack_identifier : String
    current_fontpack : PdfFontPack
    font_size : Double
    structure_tree_enabled : Bool
    auto_tag : Bool
    structure_page_number : Int
    structure_data : Array[PdfDrawStructureData]
    page_names : Array[
    PdfName
    ]
    } derive(Eq, ToJson,
    Debug
    )

    Resource allocation state for rendering cpdf draw operations.

    This ports the resource-numbering and ExtGState cache used by cpdfdraw.ml's res/fresh_name/extgstate helpers. Later rendering slices will extend this state with tagged-content resources.

    PdfDrawRenderState::equal

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

    PdfDrawRenderState::not_equal

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

    PdfDrawRenderState::resources

    Return the resource dictionary needed by the operations rendered so far.

    PdfDrawRenderState::to_json

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

    PdfDrawRenderState::to_repr

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

    PdfDrawSpecialTextContext

    Page-local context used to render PdfDrawSpecialText.

    PdfDrawSpecialTextContext::equal

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

    PdfDrawSpecialTextContext::not_equal

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

    PdfDrawSpecialTextContext::to_json

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

    PdfDrawSpecialTextContext::to_repr

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

    PdfDrawStructureData

    pub(all) enum PdfDrawStructureData {
    PdfDrawStructureMCID(String, Int, Int)
    PdfDrawStructureBeginTree(String)
    PdfDrawStructureEndTree
    PdfDrawStructureNamespace(String)
    PdfDrawStructureElementInfo(String,
    PdfObject
    )
    PdfDrawStructureEndElementInfo(String)
    } derive(Eq, ToJson,
    Debug
    )

    Tagged-PDF structure-tree event emitted while rendering draw operations.

    PdfDrawStructureData::equal

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

    PdfDrawStructureData::not_equal

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

    PdfDrawStructureData::to_json

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

    PdfDrawStructureData::to_repr

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

    PdfDrawXObjectResource

    pub(all) struct PdfDrawXObjectResource {
    source_name : String
    resource_name :
    PdfName

    object_number : Int
    } derive(Eq, ToJson,
    Debug
    )

    XObject resource tracked while rendering draw operations.

    PdfDrawXObjectResource::equal

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

    PdfDrawXObjectResource::not_equal

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

    PdfDrawXObjectResource::to_json

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

    PdfDrawXObjectResource::to_repr

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

    PdfEmbedFontSource

    pub(all) enum PdfEmbedFontSource {
    PdfEmbedPreMadeFontPack(PdfFontPack)
    PdfEmbedInfo(Bytes, String, PdfEncoding)
    PdfEmbedExistingNamedFont
    } derive(Eq, ToJson,
    Debug
    )

    Source-facing cpdf font source descriptor.

    This mirrors Cpdfembed.cpdffont: callers may supply a prebuilt font pack, request TrueType embedding from bytes and an encoding, or reuse an existing named font resource.

    PdfEmbedFontSource::equal

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

    PdfEmbedFontSource::not_equal

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

    PdfEmbedFontSource::to_json

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

    PdfEmbedFontSource::to_repr

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

    PdfEncoding

    pub(all) enum PdfEncoding {
    PdfImplicitInFontFile
    PdfStandardEncoding
    PdfMacRomanEncoding
    PdfWinAnsiEncoding
    PdfMacExpertEncoding
    PdfCustomEncoding(PdfEncoding, Array[PdfEncodingDifference])
    PdfFillUndefinedWithStandard(PdfEncoding)
    } derive(Eq, ToJson,
    Debug
    )

    Simple-font character encoding.

    PdfCustomEncoding layers /Differences over a base encoding. PdfFillUndefinedWithStandard models TrueType behavior where undefined entries fall back to StandardEncoding.

    PdfEncoding::debug_name

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

    Return a human-readable encoding label.

    PdfEncoding::equal

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

    PdfEncoding::not_equal

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

    PdfEncoding::pdf_name

    Return the PDF name for a built-in simple-font encoding.

    Custom, implicit, and fallback encodings do not have a direct PDF name and return None.

    PdfEncoding::reverse_table

    Expand this encoding to glyph-name to character-code entries.

    The order follows table; duplicate glyph names are preserved rather than collapsed.

    PdfEncoding::table

    Expand this encoding to a table of defined character-code to glyph-name entries.

    Only codes with a known glyph name are emitted. The table is ordered by increasing one-byte character code.

    PdfEncoding::to_json

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

    PdfEncoding::to_repr

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

    PdfEncodingDifference

    pub(all) struct PdfEncodingDifference {
    name :
    PdfName

    code : Int
    } derive(Eq, ToJson,
    Debug
    )

    One /Differences entry in a simple-font encoding dictionary.

    code is the one-byte character code that maps to name.

    PdfEncodingDifference::equal

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

    PdfEncodingDifference::not_equal

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

    PdfEncodingDifference::to_json

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

    PdfEncodingDifference::to_repr

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

    PdfExtractedImageFile

    pub(all) struct PdfExtractedImageFile {
    path : String
    data : Bytes
    } derive(Eq, ToJson,
    Debug
    )

    One file that cpdf-style image extraction would write.

    PdfExtractedImageFile::equal

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

    PdfExtractedImageFile::not_equal

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

    PdfExtractedImageFile::to_json

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

    PdfExtractedImageFile::to_repr

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

    PdfFont

    pub(all) enum PdfFont {
    PdfFontStandard(PdfStandardFontData)
    PdfFontSimple(PdfSimpleFont)
    PdfFontCIDKeyed(PdfCIDKeyedFont)
    } derive(Eq, ToJson,
    Debug
    )

    Parsed font model used by text extraction and font writing.

    PdfFont::content_bytes_of_charcode

    fn PdfFont::content_bytes_of_charcode(self : PdfFont, charcode : Int) -> Bytes raise
    PdfError

    Convert a cpdfcontent glyph character code back to raw PDF string bytes.

    CID-keyed fonts write the code as two big-endian bytes. Standard and simple fonts write a single byte. Out-of-range bytes raise @core.PdfError::InvalidByte, matching the source helper's char_of_int failure cases.

    PdfFont::content_charcodes_of_bytes

    fn PdfFont::content_charcodes_of_bytes(self : PdfFont, bytes : BytesView) -> Array[Int]

    Split raw PDF string bytes into cpdfcontent character codes for self.

    Standard and simple fonts use one byte per character code. CID-keyed fonts use fixed two-byte big-endian character codes, and malformed odd-length inputs return an empty array to match cpdf's charcodes_of_string.

    PdfFont::content_extra_metrics

    fn PdfFont::content_extra_metrics(self : PdfFont) -> (Double, Double)

    Return cpdfcontent's extra vertical metrics for text bounding boxes.

    Type 3 fonts transform their font bbox through the font matrix. Other described simple fonts and CID fonts use the descriptor bbox when present, falling back to ascent/descent only for a zero bbox. Standard fonts read the AFM FontBBox header, with Ascender/Descender as the zero-bbox fallback.

    PdfFont::content_is_vertical

    fn PdfFont::content_is_vertical(self : PdfFont) -> Bool

    Return whether cpdfcontent treats this font as vertical text.

    This intentionally mirrors cpdfcontent's narrow vertical helper: only the predefined /Identity-V CMap is vertical among predefined maps, and parsed external CMaps are vertical only when their wmode is 1.

    PdfFont::content_text_layout_of_bytes

    fn PdfFont::content_text_layout_of_bytes(self : PdfFont, text : BytesView, layout : PdfContentTextLayout) -> PdfContentTextLayoutResult

    Place one raw PDF text string as cpdfcontent's process_tj does.

    The returned glyph widths and placement vectors are normalized through the same Type 3-versus-1000-unit divisor as the source function. The result's text_matrix is the matrix after all glyph advances have been applied.

    PdfFont::content_text_layout_of_tj_array

    Place a normalized PDF TJ array as cpdfcontent's process_capital_tj does.

    PdfString operands are delegated to content_text_layout_of_bytes. PdfReal operands adjust the current text matrix. Other operands are ignored, matching the source function and the local content parser's normalized TJ array shape.

    PdfFont::content_width_of_charcode

    fn PdfFont::content_width_of_charcode(self : PdfFont, charcode : Int) -> (Double, Double, Double)

    Return cpdfcontent's glyph-space width triple for one character code.

    The tuple is (width, pvx, pvy). Horizontal simple and standard fonts use only width; vertical CID fonts may also return the vertical displacement vector components from /W2 or the default vertical metrics.

    PdfFont::debug_name

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

    Return a human-readable label for a parsed font.

    PdfFont::embedded_fontfile_number

    fn PdfFont::embedded_fontfile_number(self : PdfFont) -> Int?

    Return the embedded font-file stream object number for a parsed font.

    PdfFont::equal

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

    PdfFont::is_identity_h

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

    Test whether this font is a Type 0 font using /Identity-H.

    PdfFont::is_identity_v

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

    Test whether this font is a Type 0 font using /Identity-V.

    PdfFont::not_equal

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

    PdfFont::text_extractor

    fn PdfFont::text_extractor(self : PdfFont) -> PdfTextExtractor

    Build a text extractor for an already parsed font.

    PdfFont::to_json

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

    PdfFont::to_repr

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

    PdfFont::uses_two_byte_codes

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

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

    PdfFontDescriptor

    pub(all) struct PdfFontDescriptor {
    ascent : Double
    descent : Double
    avgwidth : Double
    maxwidth : Double
    flags : Int
    fontbbox :
    PdfRectangle

    italicangle : Double
    capheight : Double
    xheight : Double
    stemv : Double
    fontfile : PdfFontFile?
    charset : Array[
    PdfName
    ]?
    tounicode : Array[(Int, Bytes)]?
    } derive(Eq, ToJson,
    Debug
    )

    Parsed PDF font descriptor metrics and optional embedded font metadata.

    Numeric fields use PDF glyph-space units. tounicode stores decoded /ToUnicode mappings when the surrounding font dictionary provides them, so text extraction can prefer explicit Unicode mappings over glyph names.

    PdfFontDescriptor::equal

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

    PdfFontDescriptor::not_equal

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

    PdfFontDescriptor::to_json

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

    PdfFontDescriptor::to_repr

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

    PdfFontFile

    pub(all) enum PdfFontFile {
    PdfFontFile(Int)
    PdfFontFile2(Int)
    PdfFontFile3(Int)
    } derive(Eq, ToJson,
    Debug
    )

    Reference to an embedded font program stream in a font descriptor.

    The integer is the object number for /FontFile, /FontFile2, or /FontFile3; the constructor records which descriptor key supplied it.

    PdfFontFile::equal

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

    PdfFontFile::not_equal

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

    PdfFontFile::object_number

    fn PdfFontFile::object_number(self : PdfFontFile) -> Int

    Return the object number referenced by an embedded font-file marker.

    PdfFontFile::to_json

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

    PdfFontFile::to_repr

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

    PdfFontPack

    pub(all) struct PdfFontPack {
    fonts : Array[PdfFont]
    entries : Array[PdfFontPackEntry]
    } derive(Eq, ToJson,
    Debug
    )

    A cpdf-style font pack.

    The pack stores the fonts that can be selected while typesetting text and a Unicode codepoint lookup table returning the font index and one-byte character code. This ports the source-level cpdfembed.ml abstraction without committing the public API to a hash-table representation.

    PdfFontPack::equal

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

    PdfFontPack::get_char

    fn PdfFontPack::get_char(self : PdfFontPack, codepoint : Int) -> (Int, Int, PdfFont)?

    Look up one Unicode codepoint in a font pack.

    Returns (charcode, font_index, font) when the codepoint can be represented.

    PdfFontPack::not_equal

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

    PdfFontPack::to_json

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

    PdfFontPack::to_repr

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

    PdfFontPackEntry

    pub(all) struct PdfFontPackEntry {
    codepoint : Int
    font_index : Int
    charcode : Int
    } derive(Eq, ToJson,
    Debug
    )

    One codepoint-to-font mapping in a cpdf-style font pack.

    PdfFontPackEntry::equal

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

    PdfFontPackEntry::not_equal

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

    PdfFontPackEntry::to_json

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

    PdfFontPackEntry::to_repr

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

    PdfFunction

    pub(all) struct PdfFunction {
    func : PdfFunctionKind
    domain : Array[Double]
    range : Array[Double]?
    } derive(Eq, ToJson,
    Debug
    )

    Parsed PDF function with common domain and optional output range.

    domain is stored as low/high pairs, one pair per input. range, when present, is stored as output low/high pairs and is used to clamp evaluation results.

    PdfFunction::debug_string

    fn PdfFunction::debug_string(self : PdfFunction) -> String

    Format a parsed function as multi-line diagnostic text.

    The output follows CamlPDF's debug printer shape and is intended for inspection, not for writing a PDF function object.

    PdfFunction::equal

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

    PdfFunction::eval

    fn PdfFunction::eval(self : PdfFunction, inputs : ArrayView[Double]) -> Array[Double] raise
    PdfError

    Evaluate a PDF function for the supplied inputs.

    Inputs are clamped to domain before dispatch. The evaluated output is clamped to range when one is present. Raises @core.PdfError::BadFunctionEvaluation when arities, sampled-table indexes, calculator stack types, or child stitching bounds are invalid.

    PdfFunction::not_equal

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

    PdfFunction::to_json

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

    PdfFunction::to_repr

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

    PdfFunctionKind

    pub(all) enum PdfFunctionKind {
    PdfFunctionSampled(PdfSampledFunction)
    PdfFunctionInterpolation(PdfInterpolationFunction)
    PdfFunctionStitching(PdfStitchingFunction)
    PdfFunctionCalculator(PdfCalculatorFunction)
    } derive(Eq, ToJson,
    Debug
    )

    Discriminated PDF function body for supported /FunctionType values.

    PdfFunctionKind::equal

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

    PdfFunctionKind::not_equal

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

    PdfFunctionKind::to_json

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

    PdfFunctionKind::to_repr

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

    PdfImage

    pub(all) enum PdfImage {
    PdfJPEG(Bytes, Array[Double]?)
    PdfJPEG2000(Bytes, Array[Double]?)
    PdfJBIG2(Bytes, Array[Double]?, Int?)
    PdfRawImage(Int, Int, PdfPixelLayout, Bytes)
    } derive(Eq, ToJson,
    Debug
    )

    Extracted PDF image data.

    JPEG, JPEG2000, and JBIG2 variants keep their encoded bytes and optional decode array. PdfJBIG2 also carries the optional /JBIG2Globals object number. PdfRawImage stores width, height, layout, and decoded pixel bytes.

    PdfImage::equal

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

    PdfImage::not_equal

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

    PdfImage::to_json

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

    PdfImage::to_repr

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

    PdfInterpolationFunction

    pub(all) struct PdfInterpolationFunction {
    c0 : Array[Double]
    c1 : Array[Double]
    n : Double
    } derive(Eq, ToJson,
    Debug
    )

    PDF function type 2, exponential interpolation.

    c0 and c1 are the output vectors at the low and high ends of the input domain, and n is the exponent used to shape interpolation between them.

    PdfInterpolationFunction::equal

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

    PdfInterpolationFunction::not_equal

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

    PdfInterpolationFunction::to_json

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

    PdfInterpolationFunction::to_repr

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

    PdfObjectData

    Loading state for one entry in the document object table.

    Parsed variants hold objects that are ready to use. ObjectToParse marks an object that is known from an xref table but has not been read yet. ObjectToParseFromObjectStream records the object-stream location needed to load compressed objects lazily.

    PdfObjectData::equal

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

    PdfObjectData::not_equal

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

    PdfObjectData::to_repr

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

    PdfObjectEntry

    pub(all) struct PdfObjectEntry {
    data : PdfObjectData
    generation : Int
    } derive(Eq,
    Debug
    )

    One object-table entry together with its generation number.

    The data field is mutable so parsers can replace deferred states with parsed objects after lazy loading.

    PdfObjectEntry::equal

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

    PdfObjectEntry::not_equal

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

    PdfObjectEntry::to_repr

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

    PdfObjectEvent

    pub(all) enum PdfObjectEvent {
    ObjectAltered
    ObjectDeleted
    } derive(Eq,
    Debug
    )

    Mutation event recorded for incremental-write style bookkeeping.

    PdfObjectEvent::equal

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

    PdfObjectEvent::not_equal

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

    PdfObjectEvent::to_repr

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

    PdfObjectMap

    Sparse map from object number to object-table entry.

    This is a thin wrapper around a hash map. It does not track maximum object number or mutation events; use PdfObjects for document-level bookkeeping.

    PdfObjectMap::contains

    fn PdfObjectMap::contains(self : PdfObjectMap, number : Int) -> Bool

    Return whether number has an entry in the object map.

    PdfObjectMap::equal

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

    PdfObjectMap::get_entry

    fn PdfObjectMap::get_entry(self : PdfObjectMap, number : Int) -> PdfObjectEntry?

    Return the object-table entry for number, if present.

    PdfObjectMap::length

    fn PdfObjectMap::length(self : PdfObjectMap) -> Int

    Return the number of entries in the object map.

    PdfObjectMap::lookup_parsed_or_null

    fn PdfObjectMap::lookup_parsed_or_null(self : PdfObjectMap, number : Int) ->
    PdfObject

    Return a parsed object or PdfNull for missing/deferred entries.

    Both normal parsed objects and already-decrypted parsed objects are returned. Deferred states such as ObjectToParse are treated as absent by this helper.

    PdfObjectMap::not_equal

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

    PdfObjectMap::object_numbers

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

    Return all object numbers in ascending order.

    PdfObjectMap::remove

    fn PdfObjectMap::remove(self : PdfObjectMap, number : Int) -> Unit

    Remove an object-number entry from the map.

    Missing numbers are ignored.

    PdfObjectMap::set_entry

    fn PdfObjectMap::set_entry(self : PdfObjectMap, number : Int, entry : PdfObjectEntry) -> Unit

    Set or replace the entry for an object number.

    This low-level map operation does not update any mutation log.

    PdfObjectMap::to_repr

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

    PdfObjects

    pub struct PdfObjects {
    max_object_number : Int
    object_map : PdfObjectMap
    object_stream_ids :
    HashMap
    [Int, Int]
    log : Array[(Int, PdfObjectEvent)]
    } derive(Eq,
    Debug
    )

    Document object table with allocation, object-stream, and mutation metadata.

    PdfObjects owns the sparse object map, tracks the highest object number allocated so far, records object-stream identifiers, and stores an alteration log used by writers and tests.

    PdfObjects::add_object

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

    Add a parsed object using the next available object number.

    Returns the allocated object number and records an ObjectAltered event.

    PdfObjects::add_object_given_number

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

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

    This updates the maximum object number, stores an ObjectParsed entry, and appends ObjectAltered to the mutation log.

    PdfObjects::equal

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

    PdfObjects::get_entry

    fn PdfObjects::get_entry(self : PdfObjects, number : Int) -> PdfObjectEntry?

    Return the object-table entry for number, if present.

    PdfObjects::length

    fn PdfObjects::length(self : PdfObjects) -> Int

    Return the number of object entries currently stored.

    PdfObjects::log

    fn PdfObjects::log(self : PdfObjects) -> Array[(Int, PdfObjectEvent)]

    Return a copy of the object mutation log.

    PdfObjects::lookup_object_or_null

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

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

    PdfObjects::map_objects_in_place

    Transform every parsed object in place.

    Parsed and already-decrypted entries keep their state tags after the object value is transformed. Deferred entries are left unchanged.

    PdfObjects::max_object_number

    fn PdfObjects::max_object_number(self : PdfObjects) -> Int

    Return the highest object number allocated or loaded so far.

    PdfObjects::not_equal

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

    PdfObjects::object_numbers

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

    Return stored object numbers in ascending order.

    PdfObjects::parsed_entries

    Return parsed object entries as (number, generation, object) triples.

    Results are sorted by object number and exclude deferred entries.

    PdfObjects::remove_object

    fn PdfObjects::remove_object(self : PdfObjects, number : Int) -> Unit

    Remove an object entry and record a deletion event.

    The deletion is logged even if the object number was not present.

    PdfObjects::set_entry

    fn PdfObjects::set_entry(self : PdfObjects, number : Int, entry : PdfObjectEntry) -> Unit

    Set or replace an object-table entry without logging an alteration.

    The tracked maximum object number is raised when number exceeds the previous maximum.

    PdfObjects::stream_entries

    Return parsed stream objects as (number, generation, stream) triples.

    Results are sorted by object number and exclude non-stream or deferred entries.

    PdfObjects::to_repr

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

    PdfPNG

    pub(all) struct PdfPNG {
    width : Int
    height : Int
    bit_depth : Int
    color_type : Int
    idat : Bytes
    palette : Bytes?
    } derive(Eq, ToJson,
    Debug
    )

    Parsed PNG metadata and concatenated IDAT payload.

    This mirrors the small Cpdfpng surface needed for image insertion, with the compressed IDAT bytes preserved. idat is always a non-interlaced datastream — an Adam7 source is rebuilt into the equivalent sequential one when it is read, so consumers never see interlacing. palette carries the PLTE payload (RGB triples) for colour type 3 and is None for every other type.

    PdfPNG::equal

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

    PdfPNG::not_equal

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

    PdfPNG::to_json

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

    PdfPNG::to_repr

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

    PdfParsedCMap

    pub(all) struct PdfParsedCMap {
    map : Array[(Int, Bytes)]
    cid_map : Array[(Int, Int)]
    notdef_map : Array[(Int, Int)]
    codespaces : Array[PdfCMapCodeSpace]
    usecmap :
    PdfName
    ?
    wmode : Int?
    cmap_name :
    PdfName
    ?
    cmap_type : Int?
    cid_system_info : PdfCIDSystemInfo?
    } derive(Eq, ToJson,
    Debug
    )

    Parsed CMap or ToUnicode stream data.

    map stores character-code to UTF-16BE bytes from bfchar/bfrange, cid_map stores character-code to CID mappings, and notdef_map stores notdef fallback CIDs. Optional metadata is taken from the stream body or stream dictionary when available.

    PdfParsedCMap::equal

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

    PdfParsedCMap::not_equal

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

    PdfParsedCMap::to_json

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

    PdfParsedCMap::to_repr

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

    PdfPixelLayout

    pub(all) enum PdfPixelLayout {
    PdfBPP1
    PdfBPP8
    PdfBPP24
    PdfBPP48
    } derive(Eq, ToJson,
    Debug
    )

    Pixel layout for extracted raw image data.

    PdfPixelLayout::equal

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

    PdfPixelLayout::not_equal

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

    PdfPixelLayout::to_json

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

    PdfPixelLayout::to_repr

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

    PdfSampledFunction

    pub(all) struct PdfSampledFunction {
    size : Array[Int]
    order : Int
    encode : Array[Double]
    decode : Array[Double]
    bits_per_sample : Int
    samples : Array[Int]
    } derive(Eq, ToJson,
    Debug
    )

    PDF function type 0, sampled from a packed sample table.

    size gives the sample count for each input dimension. encode maps clamped domain inputs to sample coordinates, decode maps sample values to output values, and samples stores decoded integer samples with the first input dimension varying fastest.

    PdfSampledFunction::equal

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

    PdfSampledFunction::not_equal

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

    PdfSampledFunction::to_json

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

    PdfSampledFunction::to_repr

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

    PdfSimpleFont

    pub(all) struct PdfSimpleFont {
    fonttype : PdfSimpleFontType
    basefont :
    PdfName
    ?
    firstchar : Int
    lastchar : Int
    widths : Array[Int]
    fontdescriptor : PdfFontDescriptor?
    fontmetrics : Array[Double]?
    encoding : PdfEncoding
    } derive(Eq, ToJson,
    Debug
    )

    Parsed simple-font dictionary.

    The record preserves declared widths and descriptors when present. Missing metrics are resolved from standard-font fallback data where possible.

    PdfSimpleFont::debug_name

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

    Return a multi-line debug summary for this simple font.

    PdfSimpleFont::equal

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

    PdfSimpleFont::not_equal

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

    PdfSimpleFont::to_json

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

    PdfSimpleFont::to_repr

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

    PdfSimpleFontType

    pub(all) enum PdfSimpleFontType {
    PdfType1
    PdfMMType1
    PdfType3(PdfType3Glyphs)
    PdfTrueType
    } derive(Eq, ToJson,
    Debug
    )

    Simple-font subtype recognized by the PDF text layer.

    Type 1, MMType1, Type 3, and TrueType fonts all use one-byte character codes after their encoding differences have been applied.

    PdfSimpleFontType::debug_name

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

    Return a human-readable simple-font subtype label.

    Type 3 labels include the declared CharProc names to make debugging parsed glyph programs easier.

    PdfSimpleFontType::equal

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

    PdfSimpleFontType::not_equal

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

    PdfSimpleFontType::to_json

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

    PdfSimpleFontType::to_repr

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

    PdfStandardFont

    pub(all) enum PdfStandardFont {
    PdfTimesRoman
    PdfTimesBold
    PdfTimesItalic
    PdfTimesBoldItalic
    PdfHelvetica
    PdfHelveticaBold
    PdfHelveticaOblique
    PdfHelveticaBoldOblique
    PdfCourier
    PdfCourierBold
    PdfCourierOblique
    PdfCourierBoldOblique
    PdfSymbol
    PdfZapfDingbats
    } derive(Eq, ToJson,
    Debug
    )

    The built-in PDF standard 14 font faces.

    These values name the base fonts that a conforming PDF reader is expected to know without an embedded font program. The variants match the canonical PDF names used in /BaseFont entries.

    PdfStandardFont::afm_data

    Returns the Adobe Font Metrics data for this standard font.

    PdfStandardFont::baseline_adjustment

    fn PdfStandardFont::baseline_adjustment(self : PdfStandardFont) -> Int

    Return a synthetic baseline adjustment for simple standard-font placement.

    The value is derived from the font ascent-like metrics used by the original CamlPDF helpers and is expressed in glyph-space units.

    PdfStandardFont::equal

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

    PdfStandardFont::flags

    fn PdfStandardFont::flags(self : PdfStandardFont) -> Int

    Return PDF font descriptor flags for this standard font.

    The flags distinguish symbolic fonts, fixed-pitch Courier faces, and the nonsymbolic roman faces according to the PDF font descriptor bit layout.

    PdfStandardFont::name

    fn PdfStandardFont::name(self : PdfStandardFont) -> String

    Return the canonical standard-font name without the leading PDF slash.

    PdfStandardFont::not_equal

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

    PdfStandardFont::pdf_name

    Return the canonical PDF name object for this standard font.

    The returned name includes the leading slash in the underlying @core.PdfName bytes and is suitable for /BaseFont dictionary entries.

    PdfStandardFont::stemv

    fn PdfStandardFont::stemv(self : PdfStandardFont) -> Int

    Return the standard-font StemV descriptor value used when writing fonts.

    PdfStandardFont::text_width

    fn PdfStandardFont::text_width(self : PdfStandardFont, encoding : PdfEncoding, text : BytesView, kern? : Bool) -> Int

    Computes the width of byte-encoded text for this standard font.

    PdfStandardFont::to_json

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

    PdfStandardFont::to_repr

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

    PdfStandardFontData

    pub(all) struct PdfStandardFontData {
    font : PdfStandardFont
    encoding : PdfEncoding
    } derive(Eq, ToJson,
    Debug
    )

    Parsed standard-font data with its active character encoding.

    Standard 14 fonts do not carry embedded metrics in normal PDF files, so extraction combines the font identity with the chosen simple-font encoding.

    PdfStandardFontData::debug_name

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

    Return a compact debug label for this standard font data.

    PdfStandardFontData::equal

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

    PdfStandardFontData::not_equal

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

    PdfStandardFontData::text_width

    fn PdfStandardFontData::text_width(self : PdfStandardFontData, text : BytesView, kern? : Bool) -> Int

    Computes the width of byte-encoded text using this standard-font data and its encoding.

    PdfStandardFontData::to_json

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

    PdfStandardFontData::to_repr

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

    PdfStitchingFunction

    pub(all) struct PdfStitchingFunction {
    functions : Array[PdfFunction]
    bounds : Array[Double]
    stitch_encode : Array[Double]
    } derive(Eq, ToJson,
    Debug
    )

    PDF function type 3, stitching several child functions over one input.

    bounds partitions the parent domain, and stitch_encode maps each chosen segment into the selected child function's input domain.

    PdfStitchingFunction::equal

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

    PdfStitchingFunction::not_equal

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

    PdfStitchingFunction::to_json

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

    PdfStitchingFunction::to_repr

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

    PdfStreamEncoding

    pub(all) enum PdfStreamEncoding {
    PdfStreamASCIIHex
    PdfStreamASCII85
    PdfStreamRunLength
    PdfStreamFlate
    PdfStreamCCITT(Int, Int)
    PdfStreamCCITTG4(Int, Int)
    } derive(Eq, ToJson,
    Debug
    )

    Stream encoding requested by high-level stream encode helpers.

    CCITT variants carry image columns and rows because those values are needed in /DecodeParms when writing fax-compressed image streams.

    PdfStreamEncoding::equal

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

    PdfStreamEncoding::filter_name

    Return the PDF filter name for this stream encoding.

    PdfStreamEncoding::not_equal

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

    PdfStreamEncoding::to_json

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

    PdfStreamEncoding::to_repr

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

    PdfStreamPredictor

    pub(all) enum PdfStreamPredictor {
    PdfStreamPredictorTIFF2
    PdfStreamPredictorPNGNone
    PdfStreamPredictorPNGSub
    PdfStreamPredictorPNGUp
    PdfStreamPredictorPNGAverage
    PdfStreamPredictorPNGPaeth
    PdfStreamPredictorPNGOptimum
    } derive(Eq, ToJson,
    Debug
    )

    PNG/TIFF predictor requested when encoding stream data.

    Predictor values correspond to PDF /Predictor numbers.

    PdfStreamPredictor::equal

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

    PdfStreamPredictor::not_equal

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

    PdfStreamPredictor::number

    fn PdfStreamPredictor::number(self : PdfStreamPredictor) -> Int

    Return the PDF /Predictor number for this predictor.

    PdfStreamPredictor::to_json

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

    PdfStreamPredictor::to_repr

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

    PdfTextExtractor

    pub(all) struct PdfTextExtractor {
    font : PdfFont
    } derive(Eq, ToJson,
    Debug
    )

    Text extractor bound to a parsed font.

    The extractor converts PDF text-string bytes to character codes, glyph names, and Unicode codepoints according to the font's encoding data.

    PdfTextExtractor::charcode_of_codepoint

    fn PdfTextExtractor::charcode_of_codepoint(self : PdfTextExtractor, codepoint : Int) -> Int?

    Return a PDF character code that can encode one Unicode codepoint.

    The lookup prefers explicit ToUnicode reverse mappings, then predefined or external CMap reverse lookup, then simple-font glyph names. None means the current font has no known single-codepoint representation.

    PdfTextExtractor::codepoints_of_text

    fn PdfTextExtractor::codepoints_of_text(self : PdfTextExtractor, text : BytesView) -> Array[Int] raise
    PdfError

    Extract Unicode codepoints from PDF text bytes.

    /ToUnicode mappings take precedence. External CMaps, predefined CMaps, glyph names, and font-specific fallbacks are used when no explicit ToUnicode mapping exists. Multi-codepoint glyph names are flattened into the returned array.

    PdfTextExtractor::equal

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

    PdfTextExtractor::glyphnames_and_codepoints_of_text

    fn PdfTextExtractor::glyphnames_and_codepoints_of_text(self : PdfTextExtractor, text : BytesView) -> Array[PdfTextGlyph] raise
    PdfError

    Resolve glyph names and Unicode codepoints for each character code in text.

    This lower-level extractor exposes both sides of the mapping. The input is a PDF text byte sequence, not a MoonBit String, and malformed byte segmentation raises @core.PdfError.

    PdfTextExtractor::glyphnames_of_text

    Resolve only glyph names from PDF text bytes.

    This bypasses Unicode conversion and is useful for callers that need the encoded glyph identity rather than extracted text.

    PdfTextExtractor::not_equal

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

    PdfTextExtractor::text_width

    fn PdfTextExtractor::text_width(self : PdfTextExtractor, text : BytesView) -> Double raise
    PdfError

    Measure PDF text bytes in glyph-space units for this extractor's font.

    Text bytes are segmented according to the font encoding. Malformed byte sequences raise @core.PdfError, and missing metrics contribute width 0.

    PdfTextExtractor::to_json

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

    PdfTextExtractor::to_repr

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

    PdfTextGlyph

    pub(all) struct PdfTextGlyph {
    glyphname :
    PdfName

    codepoints : Array[Int]
    } derive(Eq, ToJson,
    Debug
    )

    Extracted glyph result for one character code.

    glyphname is the resolved PDF glyph name and codepoints is the Unicode scalar sequence inferred from ToUnicode, CMap, or Adobe glyph-list data.

    PdfTextGlyph::equal

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

    PdfTextGlyph::not_equal

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

    PdfTextGlyph::to_json

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

    PdfTextGlyph::to_repr

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

    PdfTocFontSource

    pub(all) enum PdfTocFontSource {
    PdfTocPreMadeFontPack(PdfFontPack)
    PdfTocExistingNamedFont
    } derive(Eq, ToJson,
    Debug
    )

    Font source options for table-of-contents generation.

    This ports the non-embedding cpdftoc font-source dispatch. TrueType EmbedInfo remains a separate embedding slice.

    PdfTocFontSource::equal

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

    PdfTocFontSource::not_equal

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

    PdfTocFontSource::to_json

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

    PdfTocFontSource::to_repr

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

    PdfTristimulusPoint

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

    A CIE tristimulus point used by calibrated PDF colour spaces.

    The fields represent the X, Y, and Z components used for white point and black point entries in /CalGray, /CalRGB, and /Lab dictionaries.

    PdfTristimulusPoint::equal

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

    PdfTristimulusPoint::not_equal

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

    PdfTristimulusPoint::to_json

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

    PdfTristimulusPoint::to_repr

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

    PdfType3Glyphs

    Type 3 font glyph-program data.

    charprocs keeps glyph names paired with their drawing streams and resources is the Type 3 resource dictionary used when interpreting those glyph programs.

    PdfType3Glyphs::equal

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

    PdfType3Glyphs::not_equal

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

    PdfType3Glyphs::to_json

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

    PdfType3Glyphs::to_repr

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

    PdfTypeElement

    pub(all) enum PdfTypeElement {
    PdfTypeText(Bytes)
    PdfTypeHGlue(Double)
    PdfTypeVGlue(Double)
    PdfTypeNewLine
    PdfTypeNewPage
    PdfTypeFont(String, PdfFont, Double)
    PdfTypeBeginDest(
    PdfDestination
    , String?)
    PdfTypeEndDest
    PdfTypeBeginDocument
    PdfTypeTag(String, Int)
    PdfTypeEndTag
    } derive(Eq, ToJson,
    Debug
    )

    Element stream consumed by the cpdftype layout pipeline.

    PdfTypeText stores raw one-byte PDF charcodes, matching the OCaml char list representation rather than Unicode text.

    PdfTypeElement::equal

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

    PdfTypeElement::not_equal

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

    PdfTypeElement::to_json

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

    PdfTypeElement::to_repr

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

    PdfTypeTypesetResult

    pub(all) struct PdfTypeTypesetResult {
    pages : Array[
    PdfPage
    ]
    tags : Array[Array[(String, Int)]]
    } derive(Eq, ToJson,
    Debug
    )

    Pages and per-page structure tags produced by the cpdftype typesetter.

    PdfTypeTypesetResult::equal

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

    PdfTypeTypesetResult::not_equal

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

    PdfTypeTypesetResult::to_json

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

    PdfTypeTypesetResult::to_repr

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

    PdfUASubformat

    pub(all) enum PdfUASubformat {
    PdfUA1
    PdfUA2
    } derive(Eq, ToJson,
    Debug
    )

    PDF/UA subformat selector used by CamlPDF-facing creation helpers.

    PdfUASubformat::equal

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

    PdfUASubformat::not_equal

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

    PdfUASubformat::to_json

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

    PdfUASubformat::to_repr

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

    decompress_pdf

    Compatibility wrapper for PdfDocument::decompress.

    pdf_add_annotation

    Compatibility wrapper for PdfDocument::add_annotation.

    pdf_add_bookmark_title

    fn pdf_add_bookmark_title(filename : String, use_title : Bool, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::add_bookmark_title.

    pdf_add_bookmarks

    Compatibility wrapper for PdfDocument::add_bookmarks.

    pdf_add_bookmarks_from_json

    fn pdf_add_bookmarks_from_json(verify : Bool, json : Json, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::add_bookmarks_from_json.

    pdf_add_bookmarks_from_text

    fn pdf_add_bookmarks_from_text(verify : Bool, data : BytesView, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::add_bookmarks_from_text.

    pdf_add_default_fontpack

    fn pdf_add_default_fontpack(control : PdfDrawControl, font_name : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol add_default_fontpack over explicit state.

    pdf_add_page_labels

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

    Compatibility wrapper for PdfDocument::add_page_labels.

    pdf_add_page_labels_json

    fn pdf_add_page_labels_json(document : PdfDocument, json : Json) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::add_page_labels_json.

    pdf_add_pagetree

    Copy a document, add a page tree, and return the copy with the tree root.

    pdf_add_prefix

    fn pdf_add_prefix(document : PdfDocument, prefix : String) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::add_prefix.

    pdf_add_root

    Copy a document, add a catalog root, and return the copy.

    pdf_addbezier

    fn pdf_addbezier(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addbezier.

    pdf_addbezier13

    fn pdf_addbezier13(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addbezier13.

    pdf_addbezier23

    fn pdf_addbezier23(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addbezier23.

    pdf_addbt

    fn pdf_addbt(control : PdfDrawControl) -> Unit

    Source-spelled cpdfdrawcontrol addbt over explicit draw state.

    pdf_addcharspace

    fn pdf_addcharspace(control : PdfDrawControl, spacing : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addcharspace over explicit draw state.

    pdf_addcircle

    fn pdf_addcircle(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addcircle.

    pdf_addet

    fn pdf_addet(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addet over explicit draw state.

    pdf_addimage

    fn pdf_addimage(control : PdfDrawControl, name : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addimage over explicit draw state.

    pdf_addjpeg

    fn pdf_addjpeg(control : PdfDrawControl, name : String, data : BytesView, path_to_im? : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addjpeg for supplied image bytes.

    path_to_im is accepted for source API parity with cpdf's ImageMagick fallback hook and is otherwise ignored by pdflite's in-process parser.

    pdf_addjpeg2000

    fn pdf_addjpeg2000(control : PdfDrawControl, name : String, data : BytesView) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addjpeg2000 for supplied image bytes.

    pdf_addleading

    fn pdf_addleading(control : PdfDrawControl, leading : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addleading over explicit draw state.

    pdf_addline

    fn pdf_addline(control : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addline.

    pdf_addnamespace

    fn pdf_addnamespace(control : PdfDrawControl, namespace_name : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addnamespace over explicit draw state.

    pdf_addnewline

    fn pdf_addnewline(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addnewline over explicit draw state.

    pdf_addnewpage

    fn pdf_addnewpage(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addnewpage over explicit draw state.

    pdf_addopacity

    fn pdf_addopacity(control : PdfDrawControl, opacity : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addopacity over explicit draw state.

    pdf_addpara

    fn pdf_addpara(control : PdfDrawControl, document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addpara over explicit draw state.

    pdf_addparas

    fn pdf_addparas(control : PdfDrawControl, document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addparas over explicit draw state.

    pdf_addpng

    fn pdf_addpng(control : PdfDrawControl, document : PdfDocument, name : String, data : BytesView) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addpng for supplied image bytes.

    pdf_addrect

    fn pdf_addrect(control : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addrect.

    pdf_addrectangle

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

    Source-spelled compatibility wrapper matching cpdfaddtext's addrectangle.

    pdf_addrendermode

    fn pdf_addrendermode(control : PdfDrawControl, mode : Int) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addrendermode over explicit draw state.

    pdf_addrise

    fn pdf_addrise(control : PdfDrawControl, rise : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addrise over explicit draw state.

    pdf_addsopacity

    fn pdf_addsopacity(control : PdfDrawControl, opacity : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addsopacity over explicit draw state.

    pdf_addspecialtext

    fn pdf_addspecialtext(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addspecialtext over explicit draw state.

    pdf_addstag

    fn pdf_addstag(control : PdfDrawControl, tag : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addstag over explicit draw state.

    pdf_addtag

    fn pdf_addtag(control : PdfDrawControl, tag : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addtag over explicit draw state.

    pdf_addtext

    fn pdf_addtext(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addtext over explicit draw state.

    pdf_addtext_allocate_font_names

    Allocate cpdf add-text font resource names for the selected font and optional font pack.

    pdf_addtext_baseline_offsets

    fn pdf_addtext_baseline_offsets(font : PdfFont?, font_size : Double, position :
    PdfPosition
    , rotation :
    PdfAddTextRotation
    , midline : Bool, topline : Bool) -> (Double, Double)

    Return cpdf's (horizontal, vertical) baseline shift for midline/topline add-text placement.

    pdf_addtext_bates_number

    fn pdf_addtext_bates_number(bates : Int, page_number : Int, bates_pad : Int?) -> String

    Format cpdf add-text's %Bates replacement for one page.

    pdf_addtext_bookmark_for_page

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

    Compatibility wrapper for PdfDocument::addtext_bookmark_for_page.

    pdf_addtext_calc_textwidth

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

    Compatibility wrapper for PdfDocument::addtext_calc_textwidth.

    pdf_addtext_cap_height

    fn pdf_addtext_cap_height(font : PdfFont?, fontname : String) -> Double?

    Return the cap height used by cpdf add-text URL link rectangles.

    Explicit simple-font descriptors win. Otherwise fontname is resolved as a Standard 14 font name without a leading slash, matching cpdf's fallback.

    pdf_addtext_charcodes_of_utf8

    fn pdf_addtext_charcodes_of_utf8(font : PdfFont, text : String) -> Bytes raise
    PdfError

    Convert UTF-8 add-text input to PDF charcode bytes for font.

    Codepoints not representable by the font are skipped, matching cpdf's option_map behavior in charcodes_of_utf8.

    pdf_addtext_colour_op

    Build the cpdf add-text fill colour operator.

    pdf_addtext_colour_op_stroke

    Build the cpdf add-text stroke colour operator.

    pdf_addtext_effective_encoding

    fn pdf_addtext_effective_encoding(font : PdfFont?) -> PdfEncoding

    Return the text encoding cpdf add-text uses for the selected font.

    pdf_addtext_existing_font_resource

    Compatibility wrapper for PdfDocument::addtext_existing_font_resource.

    pdf_addtext_expand_lines_with_time

    fn pdf_addtext_expand_lines_with_time(time :
    PdfStrftimeTime
    , lines : ArrayView[String], replacements : ArrayView[(String, () -> String)]) -> Array[String] raise
    PdfError

    Expand add-text lines and strip URL markup before line measurement.

    This mirrors cpdf's expand_lines behavior after callers have supplied the document-specific replacement callbacks.

    pdf_addtext_fontpack_resource_dictionary

    Replace cpdf add-text fontpack placeholders with embedded font references.

    pdf_addtext_install_font_resource

    Install one selected add-text font resource into a page resource dictionary.

    pdf_addtext_install_fontpack_resources

    Install cpdf add-text fontpack resources into a page resource dictionary.

    pdf_addtext_line_page

    fn pdf_addtext_line_page(document : 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

    Compatibility wrapper for PdfDocument::addtext_line_page.

    pdf_addtext_line_widths

    fn pdf_addtext_line_widths(document : PdfDocument, page :
    PdfPage
    , font : PdfFont?, fontpack : PdfFontPack?, fontname :
    PdfName
    , font_size : Double, text : BytesView, expanded_lines : ArrayView[Bytes]) ->
    PdfAddTextLineWidths
    raise
    PdfError

    Compatibility wrapper for PdfDocument::addtext_line_widths.

    pdf_addtext_lines_for_rotation

    fn pdf_addtext_lines_for_rotation(text : String, rotation :
    PdfAddTextRotation
    ) -> Array[String] raise
    PdfError

    Split and unescape add-text lines, reversing them for upside-down rotations.

    pdf_addtext_longest_width

    fn pdf_addtext_longest_width(widths : ArrayView[Double]) -> Double raise
    PdfError

    Return the widest add-text line width.

    pdf_addtext_measurement_bytes

    fn pdf_addtext_measurement_bytes(font : PdfFont?, fontpack : PdfFontPack?, raw : Bool, text : String) -> Bytes raise
    PdfError

    Return the byte string cpdf add-text uses for measuring a visible line.

    Raw mode and font-pack mode keep UTF-8 bytes. Selected simple-font mode converts Unicode text to PDF character codes first, matching cpdf's non-raw line measurement path.

    pdf_addtext_opacity_resources

    Compatibility wrapper for PdfDocument::addtext_opacity_resources.

    pdf_addtext_page_font_dictionary

    Compatibility wrapper for PdfDocument::addtext_page_font_dictionary.

    pdf_addtext_page_label

    fn pdf_addtext_page_label(document : PdfDocument, page_number : Int) -> String raise
    PdfError

    Compatibility wrapper for PdfDocument::addtext_page_label.

    pdf_addtext_page_lines

    fn pdf_addtext_page_lines(document : 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

    Compatibility wrapper for PdfDocument::addtext_page_lines.

    pdf_addtext_page_rest_with_annotations

    Compatibility wrapper for PdfDocument::addtext_page_rest_with_annotations.

    pdf_addtext_pages_with_font

    fn pdf_addtext_pages_with_font(document : 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

    Compatibility wrapper for PdfDocument::addtext_pages_with_font.

    pdf_addtext_prepare_line

    Compatibility wrapper for PdfDocument::addtext_prepare_line.

    pdf_addtext_process_text_with_time

    fn pdf_addtext_process_text_with_time(time :
    PdfStrftimeTime
    , text : String, replacements : ArrayView[(String, () -> String)]) -> String

    Apply cpdf add-text replacements, then run the cpdf strftime pass.

    Replacement callbacks are only evaluated for markers that occur in text, matching cpdf's string_replace_all_lazy helper.

    pdf_addtext_rectangle

    fn pdf_addtext_rectangle(document : 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

    Compatibility wrapper for PdfDocument::addtext_rectangle.

    pdf_addtext_rectangle_ops

    fn pdf_addtext_rectangle_ops(x : Double, y : Double, width : Double, height : Double, colour :
    PdfContentColour
    , outline : Bool, line_width : Double, extgstate_name :
    PdfName
    ?) -> Array[
    PdfContentOp
    ]

    Build cpdf add-rectangle content operators after placement is resolved.

    pdf_addtext_rectangle_origin

    fn pdf_addtext_rectangle_origin(bounds :
    PdfRectangle
    , position :
    PdfPosition
    , width : Double, height : Double) -> (Double, Double)

    Calculate the cpdf add-rectangle lower-left origin after placement.

    pdf_addtext_replacement_pairs

    fn pdf_addtext_replacement_pairs(values :
    PdfAddTextReplacementValues
    ) -> Array[(String, () -> String)]

    Build cpdf add-text replacement callbacks for page-local fields.

    Page labels and bookmark strings are supplied by the caller; this helper preserves cpdf's marker names and Bates/roman/page-number formatting.

    pdf_addtext_replacement_values

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

    Compatibility wrapper for PdfDocument::addtext_replacement_values.

    pdf_addtext_resource_setup

    Compatibility wrapper for PdfDocument::addtext_resource_setup.

    pdf_addtext_selected_font_object

    Compatibility wrapper for PdfDocument::addtext_selected_font_object.

    pdf_addtext_split_at_newline

    fn pdf_addtext_split_at_newline(text : String) -> Array[String]

    Split add-text input at cpdf's literal \n line marker.

    A doubled backslash before n is preserved as text, matching cpdf's split_at_newline helper.

    pdf_addtext_text_ops

    fn pdf_addtext_text_ops(font : PdfFont?, fontpack : PdfFontPack?, x : Double, y : Double, base_rotation : Double, horizontal_offset : Double, vertical_offset : Double, outline : Bool, line_width : Double, unique_fontname :
    PdfName
    , unique_fontnames : ArrayView[
    PdfName
    ], extgstate_name :
    PdfName
    ?, colour :
    PdfContentColour
    , font_size : Double, text : String, text_rotation : Double, rotation_h_offset : Double, rotation_v_offset : Double) -> Array[
    PdfContentOp
    ] raise
    PdfError

    Build cpdf add-text text-stamp content operators after placement is resolved.

    This ports the source-level cpdfaddtext.ml ops helper, including /CPDFSTAMP artifact wrapping, placement matrix, outline rendering mode, colour operators, optional opacity graphics state, simple-font charcode conversion, and fontpack run switching.

    pdf_addtext_unescape_string

    fn pdf_addtext_unescape_string(text : String) -> String raise
    PdfError

    Decode cpdf add-text backslash escapes after line splitting.

    Three-digit octal escapes emit one byte, doubled backslashes emit one backslash, and other non-newline escapes drop the backslash.

    pdf_addtext_url_annotation

    Build cpdf's URL link annotation object for add-text markup.

    pdf_addtext_url_annotation_geometry

    fn pdf_addtext_url_annotation_geometry(origin :
    Point2
    , horizontal_offset : Double, vertical_offset : Double, justification_offset : Double, rotation : Double, rotation_offset :
    Point2
    , page_rotation : Double, start_width : Double, end_width : Double, height : Double) ->
    PdfAddTextUrlAnnotationGeometry

    Calculate the transformed quad points and bounds for an add-text URL span.

    pdf_addtext_url_annotation_height

    fn pdf_addtext_url_annotation_height(font : PdfFont?, fontname : String, font_size : Double) -> Double

    Return cpdf's add-text URL annotation height for a font selection.

    pdf_addtext_url_annotation_references

    fn pdf_addtext_url_annotation_references(document : 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

    Compatibility wrapper for PdfDocument::addtext_url_annotation_references.

    pdf_addtext_url_annotation_widths

    fn pdf_addtext_url_annotation_widths(text : String, url :
    PdfAddTextUrl
    , measure : (String) -> Double) -> (Double, Double) raise
    PdfError

    Measure cpdf's start and end prefix widths for an add-text URL span.

    pdf_addtext_used_codepoints

    fn pdf_addtext_used_codepoints(lines : ArrayView[String]) -> Array[Int] raise
    PdfError

    Return the unique Unicode codepoints used by expanded add-text lines.

    This mirrors cpdf's pre-embedding used scan after replacement expansion and URL stripping. The returned order is first occurrence for deterministic callers and tests.

    pdf_addtext_width_of_existing_font_resource

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

    Compatibility wrapper for PdfDocument::addtext_width_of_existing_font_resource.

    pdf_addtext_width_of_fontpack

    fn pdf_addtext_width_of_fontpack(fontpack : PdfFontPack, font_size : Double, text : String) -> Double raise
    PdfError

    Measure UTF-8 add-text with a cpdf font pack at font_size.

    pdf_addtext_width_of_selected_font

    fn pdf_addtext_width_of_selected_font(font : PdfFont, font_size : Double, text : BytesView) -> Double

    Measure add-text bytes with the selected parsed font at font_size.

    pdf_addtext_width_of_text

    fn pdf_addtext_width_of_text(font : PdfFont, text : BytesView) -> Double

    Measure cpdf add-text charcode bytes with simple-font metrics.

    This mirrors cpdf's narrow width_of_text helper: only simple fonts with explicit fontmetrics are measured, and any missing metric makes the whole result 0.

    pdf_addtexts_with_font

    fn pdf_addtexts_with_font(document : 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

    Compatibility wrapper for PdfDocument::addtexts_with_font.

    pdf_addtexts_with_source

    fn pdf_addtexts_with_source(document : 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

    Compatibility wrapper for PdfDocument::addtexts_with_source.

    pdf_addtextscale

    fn pdf_addtextscale(control : PdfDrawControl, scale : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addtextscale over explicit draw state.

    pdf_addto

    fn pdf_addto(control : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's addto.

    pdf_addwordspace

    fn pdf_addwordspace(control : PdfDrawControl, spacing : Double) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol addwordspace over explicit draw state.

    pdf_allupright

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

    Compatibility wrapper for PdfDocument::all_pages_upright.

    pdf_allupright_cpdf_order

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

    Compatibility wrapper matching cpdfpage's allupright argument order.

    pdf_alluprightonly

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

    Compatibility wrapper for PdfDocument::all_pages_upright_only.

    pdf_alluprightonly_cpdf_order

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

    Compatibility wrapper matching cpdfpage's alluprightonly argument order.

    pdf_annotations_of_page

    Compatibility wrapper for PdfDocument::annotations_of_page.

    pdf_append_page_content

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

    Compatibility wrapper for PdfDocument::append_page_content.

    pdf_append_page_content_cpdf_order

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

    Compatibility wrapper matching cpdftweak's append_page_content argument order.

    pdf_append_page_content_multiple

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

    Compatibility wrapper for PdfDocument::append_page_content_multiple.

    pdf_append_page_content_multiple_cpdf_order

    fn pdf_append_page_content_multiple_cpdf_order(contents : ArrayView[Bytes], before : Bool, fast : Bool, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftweak's append_page_content_multiple argument order.

    pdf_append_page_content_multiple_ops

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

    Compatibility wrapper for PdfDocument::append_page_content_multiple_ops.

    pdf_append_page_content_multiple_ops_cpdf_order

    fn pdf_append_page_content_multiple_ops_cpdf_order(op_lists : ArrayView[Array[
    PdfContentOp
    ]], before : Bool, fast : Bool, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftweak's append_page_content_multiple_ops argument order.

    pdf_append_page_content_ops

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

    Compatibility wrapper for PdfDocument::append_page_content_ops.

    pdf_apply

    fn pdf_apply(document : PdfDocument, page_numbers : ArrayView[Int]) -> Unit

    Compatibility wrapper matching cpdfredact's apply.

    pdf_apply_redaction_type

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

    Compatibility wrapper for PdfDocument::apply_redaction_type.

    pdf_apply_redactions

    fn pdf_apply_redactions(document : PdfDocument, page_numbers : ArrayView[Int]) -> Unit

    Compatibility wrapper for PdfDocument::apply_redactions.

    pdf_apply_type

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

    Compatibility wrapper matching cpdfredact's apply_type.

    pdf_artifact

    fn pdf_artifact(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol artifact over explicit draw state.

    pdf_attach_file

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

    Compatibility wrapper for PdfDocument::attach_file.

    pdf_attach_file_cpdf_order

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

    Source-order compatibility wrapper for cpdfattach's in-memory attach path.

    The OCaml source also has a filesystem path branch; native filesystem reads live in async_io/pdf_attach_file_from_path.

    pdf_attachment_remove_unsafe_characters

    fn pdf_attachment_remove_unsafe_characters(text : String) -> String raise
    PdfError

    Remove characters which are unsafe in attachment dump filenames.

    Input and output are Unicode text. This mirrors cpdf's filtering set and intentionally preserves a leading dot, matching the source behavior.

    pdf_autoartifacts

    fn pdf_autoartifacts(control : PdfDrawControl, enabled : Bool) -> Unit

    Source-spelled cpdfdrawcontrol autoartifacts over explicit draw state.

    pdf_autotags

    fn pdf_autotags(control : PdfDrawControl, enabled : Bool) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol autotags over explicit draw state.

    pdf_black_fills

    Compatibility wrapper for PdfDocument::black_fills.

    pdf_black_lines

    Compatibility wrapper for PdfDocument::black_lines.

    pdf_black_text

    Compatibility wrapper for PdfDocument::black_text.

    pdf_black_text_ops

    Rewrite text content so text is painted with colour.

    Colour and graphics-state operators inside text blocks are moved after the text block, while non-text drawing operators inside the text block are copied after ET, matching cpdftweak.ml's blacktext_ops.

    pdf_blackfills

    Compatibility wrapper matching cpdftweak's blackfills name and order.

    pdf_blacklines

    Compatibility wrapper matching cpdftweak's blacklines name and order.

    pdf_blacktext

    Compatibility wrapper matching cpdftweak's blacktext name and order.

    pdf_blank_document

    fn pdf_blank_document(width : Double, height : Double, page_count : Int) -> PdfDocument raise
    PdfError

    Create a blank document from page dimensions in PDF points.

    pdf_blank_document_paper

    Create a blank document from a named paper size.

    pdf_bookmark_name_of_spec

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

    Compatibility wrapper for PdfDocument::bookmark_name_of_spec.

    pdf_bookmarks_open_to_level

    fn pdf_bookmarks_open_to_level(level : Int, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::bookmarks_open_to_level.

    pdf_build_name_tree

    Build either a name tree or a number tree from byte-keyed entries.

    When is_number is false, this delegates to build_name_tree. When it is true, keys must be signed 32-bit decimal ASCII and are converted to integers before building a number tree; invalid keys raise @core.PdfError::NumberExpected.

    pdf_bytes_of_xmltree

    Source-spelled compatibility alias for cpdfmetadata's bytes_of_xmltree.

    pdf_ccitt_encode

    fn pdf_ccitt_encode(columns : Int, rows : Int, data : Bytes) -> Bytes raise
    PdfError

    Owned-byte wrapper for pdf_ccitt_encode_view.

    pdf_ccitt_encode_view

    fn pdf_ccitt_encode_view(columns : Int, rows : Int, data : BytesView) -> Bytes raise
    PdfError

    Encode 1-bit image data as CCITT Group 3 one-dimensional fax data.

    pdf_ccitt_g4_encode

    fn pdf_ccitt_g4_encode(columns : Int, rows : Int, data : Bytes) -> Bytes raise
    PdfError

    Owned-byte wrapper for pdf_ccitt_g4_encode_view.

    pdf_ccitt_g4_encode_view

    fn pdf_ccitt_g4_encode_view(columns : Int, rows : Int, data : BytesView) -> Bytes raise
    PdfError

    Encode 1-bit image data as CCITT Group 4 fax data.

    pdf_center_to_fit

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

    Compatibility wrapper matching cpdfpage's center_to_fit value order.

    pdf_center_to_fit_pages

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

    Compatibility wrapper for PdfDocument::center_to_fit_pages.

    pdf_change_bookmark

    Renumber page-object targets in one bookmark.

    changes contains (old_object_number, new_object_number) pairs. Targets without a matching page-object number are preserved.

    pdf_change_boxes

    fn pdf_change_boxes(document : PdfDocument, page :
    PdfPage
    , transform : (Double, Double, Double, Double) -> (Double, Double, Double, Double)) ->
    PdfPage
    raise
    PdfError

    Compatibility wrapper for PdfDocument::change_boxes.

    pdf_change_boxes_cpdf_order

    fn pdf_change_boxes_cpdf_order(transform : (Double, Double, Double, Double) -> (Double, Double, Double, Double), document : PdfDocument, page :
    PdfPage
    ) ->
    PdfPage
    raise
    PdfError

    Compatibility wrapper matching cpdfpage's change_boxes argument order.

    pdf_change_pages

    fn pdf_change_pages(change_references : Bool, document : PdfDocument, pages : ArrayView[
    PdfPage
    ], matrices? : ArrayView[(Int,
    TransformMatrix
    )], changes? : ArrayView[(Int, Int)]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::change_pages.

    pdf_change_pattern_matrices_page

    Compatibility wrapper matching cpdfpage's change_pattern_matrices_page.

    pdf_charcode_extractor_of_font

    fn pdf_charcode_extractor_of_font(document : PdfDocument, font :
    PdfObject
    , debug? : Bool) -> ((Int) -> Int?) raise
    PdfError

    Read a font dictionary and build a pure Unicode-to-charcode closure.

    debug is accepted for CamlPDF API compatibility; this implementation preserves pure lookup behavior and does not write missing-glyph diagnostics.

    pdf_charcode_extractor_of_font_real

    fn pdf_charcode_extractor_of_font_real(font : PdfFont, debug? : Bool) -> ((Int) -> Int?)

    Build a pure reverse lookup closure for an already parsed font.

    The returned closure maps one Unicode codepoint to the first matching PDF character code when the font can represent it. debug is accepted for CamlPDF API compatibility; this implementation does not write diagnostics.

    pdf_check_injectible

    fn pdf_check_injectible(text : String) -> Unit raise
    PdfError

    Check that a path-like string is safe to pass through shell-style contexts.

    This ports cpdf's injectible-character guard, but reports a checked @core.PdfError::InsecurePathName instead of terminating the process.

    pdf_chop

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

    Compatibility wrapper for PdfDocument::chop.

    pdf_chop_cpdf_order

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

    Compatibility wrapper matching cpdfchop's source argument order.

    pdf_chop_hv

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

    Compatibility wrapper for PdfDocument::chop_hv.

    pdf_chop_hv_cpdf_order

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

    Compatibility wrapper matching cpdfchop's source argument order.

    pdf_clear_progress_output

    fn pdf_clear_progress_output() -> Unit

    Clear captured progress output.

    pdf_clip

    fn pdf_clip(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's clip.

    pdf_clip_contour

    fn pdf_clip_contour(hole : Bool, vertices : ArrayView[PdfClipVertex]) -> PdfClipContour

    Build a cpdf/GPC polygon contour, copying the input vertex view.

    pdf_clip_make_polygon

    fn pdf_clip_make_polygon(holes : ArrayView[Bool], vertex_arrays : ArrayView[Array[PdfClipVertex]]) -> PdfClipPolygon raise
    PdfError

    Build a cpdf/GPC polygon from parallel hole flags and vertex arrays.

    Raises @core.PdfError::BadNumberArgument when the inputs have different lengths.

    pdf_clip_null_polygon

    fn pdf_clip_null_polygon() -> PdfClipPolygon

    Return the cpdf null GPC polygon.

    pdf_clip_polygon

    fn pdf_clip_polygon(contours : ArrayView[PdfClipContour]) -> PdfClipPolygon

    Build a cpdf/GPC polygon, copying the input contours and their vertices.

    pdf_clip_polygon_clip

    fn pdf_clip_polygon_clip(operation : PdfClipOperation, subject : PdfClipPolygon, clip : PdfClipPolygon) -> PdfClipPolygon raise
    PdfError

    Clip subject by clip using cpdf's GPC-backed polygon operation.

    This native-target wrapper preserves cpdf's operation-code mapping and raises @core.PdfError::BadNumberArgument when the native GPC bridge rejects the encoded polygon payload.

    pdf_clip_polygon_of_box

    fn pdf_clip_polygon_of_box(xmin : Double, xmax : Double, ymin : Double, ymax : Double) -> PdfClipPolygon

    Build the cpdf/GPC rectangle polygon for [xmin, xmax] x [ymin, ymax].

    pdf_clip_vertex

    fn pdf_clip_vertex(x : Double, y : Double) -> PdfClipVertex

    Build a cpdf/GPC polygon vertex.

    pdf_clipevenodd

    fn pdf_clipevenodd(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's clipevenodd.

    pdf_closepath

    fn pdf_closepath(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's closepath.

    pdf_codepoint_of_pdfdocencoding_byte

    fn pdf_codepoint_of_pdfdocencoding_byte(value : Int) -> Int raise
    PdfError

    Decode one PDFDocEncoding byte to a Unicode codepoint.

    Undefined byte values raise @core.PdfError::InvalidPDFDocEncoding.

    pdf_codepoints_of_pdfdocencoding

    fn pdf_codepoints_of_pdfdocencoding(bytes : BytesView) -> Array[Int] raise
    PdfError

    Decode a PDFDocEncoding byte string to Unicode codepoints.

    pdf_codepoints_of_pdfdocstring

    fn pdf_codepoints_of_pdfdocstring(bytes : BytesView) -> Array[Int] raise
    PdfError

    Decode a PDF string to Unicode codepoints.

    BOM-prefixed strings are treated as UTF-16BE. Other byte strings are decoded as PDFDocEncoding.

    pdf_codepoints_of_text

    fn pdf_codepoints_of_text(extractor : PdfTextExtractor, text : BytesView) -> Array[Int] raise
    PdfError

    Compatibility wrapper for PdfTextExtractor::codepoints_of_text.

    pdf_codepoints_of_utf16be

    fn pdf_codepoints_of_utf16be(bytes : BytesView) -> Array[Int] raise
    PdfError

    Decode UTF-16BE bytes into Unicode scalar values.

    The input should not include the leading FE FF BOM; callers that receive a PDF Unicode string normally pass bytes[2:]. Odd lengths, lone surrogates, and malformed pairs raise @core.PdfError::InvalidUTF16BE.

    pdf_codepoints_of_utf8

    fn pdf_codepoints_of_utf8(bytes : BytesView) -> Array[Int] raise
    PdfError

    Decode UTF-8 bytes into Unicode scalar values.

    Overlong encodings, invalid continuation bytes, truncated sequences, and surrogate or out-of-range scalar values raise @core.PdfError::InvalidUTF8 or @core.PdfError::InvalidUnicodeCodepoint.

    pdf_collate_runs

    fn[A, B : Eq, C] pdf_collate_runs(runs : ArrayView[(A, B, C)]) -> Array[Array[(A, B, C)]]

    Source-spelled compatibility wrapper for cpdfembed's collate_runs.

    pdf_colour_op

    Source-spelled compatibility wrapper for cpdfaddtext's colour_op.

    pdf_colour_op_stroke

    Source-spelled compatibility wrapper for cpdfaddtext's colour_op_stroke.

    pdf_colour_space_components

    Compatibility wrapper for PdfDocument::colour_space_components.

    pdf_colour_space_content_json

    fn pdf_colour_space_content_json(space : PdfColourSpace) -> Json

    Compatibility wrapper for PdfColourSpace::content_json.

    pdf_colour_space_of_device_name

    fn pdf_colour_space_of_device_name(name :
    PdfName
    ) -> PdfColourSpace?

    Parse a built-in PDF device colour-space name.

    Accepts the standard names /DeviceGray, /DeviceRGB, /DeviceCMYK, and /Pattern, together with the abbreviated resource names /G, /RGB, and /CMYK.

    pdf_colour_space_of_object

    fn pdf_colour_space_of_object(object :
    PdfObject
    ) -> PdfColourSpace?

    Parse a simple colour-space object without consulting resources.

    This recognizes device colour-space names, singleton arrays, and pattern-with-base arrays. Use PdfDocument::read_colour_space when resource lookup, calibrated spaces, ICC profiles, or indexed spaces are needed.

    pdf_combine_pages

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

    Compatibility wrapper for PdfDocument::combine_pages.

    pdf_combine_pages_cpdf_order

    fn pdf_combine_pages_cpdf_order(process_struct_tree : Bool, fast : Bool, under : PdfDocument, overlay : PdfDocument, scale_to_fit : Bool, overlay_is_under : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's combine_pages argument order.

    pdf_composition

    Compatibility wrapper for PdfDocument::composition.

    pdf_contains_javascript

    fn pdf_contains_javascript(document : PdfDocument) -> Bool

    Compatibility wrapper for PdfDocument::contains_javascript.

    pdf_content_apply_core_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_core_op.

    pdf_content_apply_extgstate_alpha_op

    fn pdf_content_apply_extgstate_alpha_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_alpha_op.

    pdf_content_apply_extgstate_compositing_op

    fn pdf_content_apply_extgstate_compositing_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_compositing_op.

    pdf_content_apply_extgstate_dash_op

    Compatibility wrapper for PdfDocument::content_apply_extgstate_dash_op.

    pdf_content_apply_extgstate_font_op

    Compatibility wrapper for PdfDocument::content_apply_extgstate_font_op.

    pdf_content_apply_extgstate_graphics_parameter_op

    fn pdf_content_apply_extgstate_graphics_parameter_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_graphics_parameter_op.

    pdf_content_apply_extgstate_halftone_op

    fn pdf_content_apply_extgstate_halftone_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_halftone_op.

    pdf_content_apply_extgstate_overprint_op

    fn pdf_content_apply_extgstate_overprint_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_overprint_op.

    pdf_content_apply_extgstate_rendering_op

    fn pdf_content_apply_extgstate_rendering_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_rendering_op.

    pdf_content_apply_extgstate_resource_op

    Compatibility wrapper for PdfDocument::content_apply_extgstate_resource_op.

    pdf_content_apply_extgstate_text_op

    fn pdf_content_apply_extgstate_text_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_text_op.

    pdf_content_apply_extgstate_transfer_op

    fn pdf_content_apply_extgstate_transfer_op(document : PdfDocument, state : PdfContentOperatorState, extgstate :
    PdfObject
    ) -> PdfContentOperatorState

    Compatibility wrapper for PdfDocument::content_apply_extgstate_transfer_op.

    pdf_content_apply_font_resource_op

    Compatibility wrapper for PdfDocument::content_apply_font_resource_op.

    pdf_content_apply_graphics_parameter_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_graphics_parameter_op.

    pdf_content_apply_graphics_state_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_graphics_state_op.

    pdf_content_apply_marked_content_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_marked_content_op.

    pdf_content_apply_path_state_op

    Compatibility wrapper for PdfContentPathState::content_apply_path_state_op.

    pdf_content_apply_resource_op

    Compatibility wrapper for PdfDocument::content_apply_resource_op.

    pdf_content_apply_text_op

    Compatibility wrapper for PdfContentTextState::content_apply_text_op.

    pdf_content_apply_text_resource_op

    Compatibility wrapper for PdfDocument::content_apply_text_resource_op.

    pdf_content_apply_text_show_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_text_show_op.

    pdf_content_apply_text_state_op

    Compatibility wrapper for PdfContentTextState::content_apply_text_state_op.

    pdf_content_apply_type3_metrics_op

    Compatibility wrapper for PdfContentOperatorState::content_apply_type3_metrics_op.

    pdf_content_bounding_box_content_json

    fn pdf_content_bounding_box_content_json(bbox : PdfContentBoundingBox) -> Json

    Compatibility wrapper for PdfContentBoundingBox::content_json.

    pdf_content_bytes_of_charcode

    fn pdf_content_bytes_of_charcode(font : PdfFont, charcode : Int) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfFont::content_bytes_of_charcode.

    pdf_content_bytes_of_op

    Serialize one content operator to PDF content-stream bytes.

    pdf_content_bytes_of_ops

    Serialize content operators to PDF content-stream bytes.

    Operators are separated with whitespace. Op_Unknown bytes are emitted as captured. Inline images with no filter are Flate-encoded and written with inline /F /Fl and /L metadata; inline images with existing filters keep their supplied encoded data and decode parameters.

    pdf_content_charcodes_of_bytes

    fn pdf_content_charcodes_of_bytes(bytes : BytesView, font : PdfFont) -> Array[Int]

    Compatibility wrapper for PdfFont::content_charcodes_of_bytes.

    pdf_content_clipping_state_content_json

    fn pdf_content_clipping_state_content_json(state : PdfContentClippingState) -> Json

    Compatibility wrapper for PdfContentClippingState::content_json.

    pdf_content_clipping_state_of_paths

    fn pdf_content_clipping_state_of_paths(clipping_path : ArrayView[
    PdfPath
    ]) -> PdfContentClippingState

    Return a clipping-only content state from the current clipping path stack.

    pdf_content_colour_values_content_json

    fn pdf_content_colour_values_content_json(values : PdfContentColourValues) -> Json

    Compatibility wrapper for PdfContentColourValues::content_json.

    pdf_content_concat_stream_views

    fn pdf_content_concat_stream_views(streams : ArrayView[BytesView]) -> Bytes

    Concatenate already-decoded content stream views with a single space between them.

    pdf_content_concat_streams

    fn pdf_content_concat_streams(streams : ArrayView[Bytes]) -> Bytes

    Concatenate already-decoded content streams with a single space between them.

    pdf_content_dash_pattern_content_json

    fn pdf_content_dash_pattern_content_json(pattern : PdfContentDashPattern) -> Json

    Compatibility wrapper for PdfContentDashPattern::content_json.

    pdf_content_entries_of_ops

    Compatibility wrapper for PdfDocument::content_entries_of_ops.

    pdf_content_entries_of_ops_recursive

    Compatibility wrapper for PdfDocument::content_entries_of_ops_recursive.

    pdf_content_entries_of_page

    Compatibility wrapper for PdfDocument::content_entries_of_page.

    pdf_content_extra_metrics

    fn pdf_content_extra_metrics(font : PdfFont) -> (Double, Double)

    Compatibility wrapper for PdfFont::content_extra_metrics.

    pdf_content_form_xobject_enter_state

    Compatibility wrapper for PdfDocument::content_form_xobject_enter_state.

    pdf_content_form_xobject_ops

    Compatibility wrapper for PdfDocument::content_form_xobject_ops.

    pdf_content_form_xobject_resources

    Compatibility wrapper for PdfDocument::content_form_xobject_resources.

    pdf_content_glyph_state_content_json

    fn pdf_content_glyph_state_content_json(state : PdfContentGlyphState) -> Json

    Compatibility wrapper for PdfContentGlyphState::content_json.

    pdf_content_glyph_state_of_text_state

    fn pdf_content_glyph_state_of_text_state(state : PdfContentTextState, clipping_path : ArrayView[
    PdfPath
    ]) -> PdfContentGlyphState

    Compatibility wrapper for PdfContentTextState::content_glyph_state.

    pdf_content_image_entry

    Compatibility wrapper for PdfContentOperatorState::content_image_entry.

    pdf_content_image_entry_from_resources

    Compatibility wrapper for PdfDocument::content_image_entry_from_resources.

    pdf_content_initial_clipping_path

    fn pdf_content_initial_clipping_path(minx : Double, miny : Double, maxx : Double, maxy : Double) -> Array[
    PdfPath
    ]

    Return cpdfcontent's initial page-boundary clipping path.

    pdf_content_initial_clipping_state

    fn pdf_content_initial_clipping_state(minx : Double, miny : Double, maxx : Double, maxy : Double) -> PdfContentClippingState

    Return cpdfcontent's initial clipping-only state for a page boundary.

    pdf_content_initial_drawn_path

    fn pdf_content_initial_drawn_path() ->
    PdfDrawnPath

    Return cpdfcontent's initial drawn-path placeholder.

    pdf_content_initial_glyph_state

    fn pdf_content_initial_glyph_state(minx : Double, miny : Double, maxx : Double, maxy : Double) -> PdfContentGlyphState

    Return cpdfcontent's initial glyph state fields for a page boundary.

    pdf_content_initial_operator_state

    fn pdf_content_initial_operator_state(minx : Double, miny : Double, maxx : Double, maxy : Double) -> PdfContentOperatorState

    Return cpdfcontent's initial operator state for a page boundary.

    pdf_content_initial_path_state

    fn pdf_content_initial_path_state(minx : Double, miny : Double, maxx : Double, maxy : Double) -> PdfContentPathState

    Return cpdfcontent's initial path drawing state for a page boundary.

    pdf_content_initial_text_state

    fn pdf_content_initial_text_state() -> PdfContentTextState

    Return cpdfcontent's initial text state.

    pdf_content_inline_image_entry

    fn pdf_content_inline_image_entry(state : PdfContentOperatorState) -> PdfContentJsonEntry

    Compatibility wrapper for PdfContentOperatorState::content_inline_image_entry.

    pdf_content_is_vertical

    fn pdf_content_is_vertical(font : PdfFont) -> Bool

    Compatibility wrapper for PdfFont::content_is_vertical.

    pdf_content_json_entries_content_json

    fn pdf_content_json_entries_content_json(entries : ArrayView[PdfContentJsonEntry]) -> Json

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

    pdf_content_json_entry_content_json

    fn pdf_content_json_entry_content_json(entry : PdfContentJsonEntry) -> Json

    Compatibility wrapper for PdfContentJsonEntry::content_json.

    pdf_content_json_of_ops

    Compatibility wrapper for PdfDocument::content_json_of_ops.

    pdf_content_json_of_page

    Compatibility wrapper for PdfDocument::content_json_of_page.

    pdf_content_object_content_json

    fn pdf_content_object_content_json(object : PdfContentObject) -> Json

    Compatibility wrapper for PdfContentObject::content_json.

    pdf_content_path_entry

    fn pdf_content_path_entry(state : PdfContentOperatorState, stroking : Bool) -> PdfContentJsonEntry?

    Compatibility wrapper for PdfContentOperatorState::content_path_entry.

    pdf_content_path_state_content_json

    fn pdf_content_path_state_content_json(state : PdfContentPathState) -> Json

    Compatibility wrapper for PdfContentPathState::content_json.

    pdf_content_path_state_with_clipping_path

    fn pdf_content_path_state_with_clipping_path(state : PdfContentPathState, clipping_path : ArrayView[
    PdfPath
    ]) -> PdfContentPathState

    Compatibility wrapper for PdfContentPathState::content_with_clipping_path.

    pdf_content_read_pattern

    Function wrapper for PdfDocument::content_read_pattern.

    pdf_content_read_tiling_pattern

    fn pdf_content_read_tiling_pattern(_pattern :
    PdfObject
    ) -> PdfContentPattern

    Read a tiling pattern as the current placeholder representation.

    pdf_content_shading_entry

    Compatibility wrapper for PdfContentOperatorState::content_shading_entry.

    pdf_content_shading_entry_from_resources

    fn pdf_content_shading_entry_from_resources(document : PdfDocument, state : PdfContentOperatorState, resources :
    PdfObject
    , name :
    PdfName
    ) -> PdfContentJsonEntry?

    Compatibility wrapper for PdfDocument::content_shading_entry_from_resources.

    pdf_content_state_content_json

    fn pdf_content_state_content_json(state : PdfContentState) -> Json

    Compatibility wrapper for PdfContentState::content_json.

    pdf_content_stream_of_ops

    Build an uncompressed PDF stream object from content operators.

    The returned stream dictionary contains /Length for the serialized byte length and no outer stream filter.

    pdf_content_text_glyph_entry

    Compatibility wrapper for PdfContentOperatorState::content_text_glyph_entry.

    pdf_content_text_layout_of_bytes

    fn pdf_content_text_layout_of_bytes(font : PdfFont, text : BytesView, layout : PdfContentTextLayout) -> PdfContentTextLayoutResult

    Compatibility wrapper for PdfFont::content_text_layout_of_bytes.

    pdf_content_text_layout_of_tj_array

    fn pdf_content_text_layout_of_tj_array(font : PdfFont, elements : ArrayView[
    PdfObject
    ], layout : PdfContentTextLayout) -> PdfContentTextLayoutResult

    Compatibility wrapper for PdfFont::content_text_layout_of_tj_array.

    pdf_content_to_json

    Source-spelled compatibility wrapper for cpdfcontent's to_json.

    pdf_content_width_of_charcode

    fn pdf_content_width_of_charcode(font : PdfFont, charcode : Int) -> (Double, Double, Double)

    Compatibility wrapper for PdfFont::content_width_of_charcode.

    pdf_copy_annotations

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

    Compatibility wrapper for PdfDocument::copy_annotations_from.

    pdf_copy_box

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

    Compatibility wrapper matching cpdfpage's copy_box argument order.

    pdf_copy_font

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

    Compatibility wrapper for PdfDocument::copy_font_from.

    pdf_copy_id

    fn pdf_copy_id(keep_version : Bool, copy_from : PdfDocument, copy_to : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::copy_id_from.

    pdf_copy_page_box

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

    Compatibility wrapper for PdfDocument::copy_page_box.

    pdf_create_metadata

    fn pdf_create_metadata(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::create_metadata.

    pdf_crop_pdf

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

    Compatibility wrapper for PdfDocument::crop_pages.

    pdf_crop_pdf_string

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

    Compatibility wrapper matching cpdfpage's crop_pdf value argument order.

    pdf_current_time

    Return the current local time on the native target.

    pdf_date_of_object

    Extracts and parses a PDF date from a PdfString object.

    Raises @core.PdfError::BadDate if the object is not a string or if the date payload is malformed.

    pdf_debug_image_processing

    fn pdf_debug_image_processing() -> Bool

    Source-spelled cpdfimage debug_image_processing flag reader.

    pdf_debug_objects

    fn pdf_debug_objects(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::debug_objects.

    pdf_decode_filter_bytes

    fn pdf_decode_filter_bytes(filter :
    PdfName
    , data : Bytes) -> Bytes raise
    PdfError

    Decode owned bytes with a single PDF filter name.

    Identity and Flate paths avoid an extra copy where possible.

    pdf_decode_filter_view

    fn pdf_decode_filter_view(filter :
    PdfName
    , data : BytesView) -> Bytes raise
    PdfError

    Decode bytes with a single PDF filter name.

    Recognizes long and abbreviated filter names. /Crypt is treated as an identity filter at this byte-dispatch layer; unsupported filters raise @core.PdfError::FilterNotSupported.

    pdf_decode_predictor

    fn pdf_decode_predictor(predictor : Int, colors : Int, bits_per_component : Int, columns : Int, data : Bytes) -> Bytes raise
    PdfError

    Owned-byte wrapper for pdf_decode_predictor_view.

    Predictor 1 returns the original owned bytes unchanged.

    pdf_decode_predictor_view

    fn pdf_decode_predictor_view(predictor : Int, colors : Int, bits_per_component : Int, columns : Int, data : BytesView) -> Bytes raise
    PdfError

    Decode data after applying a PDF predictor.

    Predictor 1 is identity, 2 is TIFF horizontal differencing, and 10..15 are PNG predictors. Invalid image geometry or unsupported predictors raise @core.PdfError.

    pdf_decode_stream

    Decode all supported filter stages from a direct stream object.

    pdf_decode_stream_onestage

    Decode exactly one filter stage from a stream object.

    The first filter and matching decode parameters are removed from the stream dictionary, and /Length is refreshed. Non-stream objects raise @core.PdfError::ParseStreamExpected.

    pdf_decompress_pdf

    fn pdf_decompress_pdf(document : PdfDocument) -> PdfDocument raise
    PdfError

    pdf_-prefixed compatibility alias for cpdfsqueeze's decompress_pdf.

    pdf_determine_subformats

    fn pdf_determine_subformats(document : PdfDocument) -> Array[String] raise
    PdfError

    Compatibility wrapper for PdfDocument::determine_subformats.

    pdf_deterministic_aes_iv_provider_from_seed

    fn pdf_deterministic_aes_iv_provider_from_seed(seed : BytesView) -> ((Int, Int, Int) -> Bytes raise
    PdfError
    )

    Build a deterministic AES IV provider from a seed.

    The returned callback derives 16-byte IVs from the seed, object number, generation, and per-object IV index. It is intended for reproducible tests and fixtures; production encryption should use a cryptographically secure random provider.

    pdf_deterministic_aesv3_random_provider_from_seed

    fn pdf_deterministic_aesv3_random_provider_from_seed(seed : BytesView) -> ((
    PdfAesV3RandomField
    , Int) -> Bytes raise
    PdfError
    )

    Build a deterministic AESV3 random-field provider from a seed.

    The provider derives field-specific bytes for file keys, salts, and permissions padding. It is useful for stable test fixtures, not for production encryption.

    pdf_dict_entry_values

    Compatibility wrapper for PdfDocument::dict_entry_values.

    pdf_document_empty

    fn pdf_document_empty() -> PdfDocument

    Construct an empty PDF document with CamlPDF-compatible defaults.

    The default version is 1.0, the root object number is 0, the trailer is an empty dictionary, and revision_read starts at 1.

    pdf_document_of_json

    fn pdf_document_of_json(json : Json) -> PdfDocument raise
    PdfError

    Convert a CPDFJSON top-level array into an in-memory PDF document.

    This ports cpdf's pdf_of_json document-input path. Object -1 supplies CPDFJSON parameters, object 0 supplies the trailer dictionary, positive object numbers populate the document object table, and other negative object numbers are ignored. /CPDFJSONstreamdataincluded false is rejected because the stream bytes needed for reconstruction are not present.

    pdf_document_of_json_blob

    fn pdf_document_of_json_blob(data : BytesView) -> PdfDocument raise
    PdfError

    Read a CPDFJSON document from UTF-8 JSON bytes.

    This is the in-memory byte-input counterpart of cpdf's Cpdfjson.of_input.

    pdf_document_of_parsed_indirect_objects

    Build a document from already parsed indirect objects.

    Objects are loaded at their existing object numbers and generations without recording mutation events. The document version defaults to @reader.pdf_default_version.

    pdf_draft

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

    Compatibility wrapper for PdfDocument::draft.

    pdf_draft_string

    fn pdf_draft_string(only_remove : String?, boxes : Bool, page_numbers : ArrayView[Int], document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfdraft's string only_remove argument.

    pdf_draw

    fn pdf_draw(document : 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

    Compatibility wrapper for PdfDocument::draw.

    pdf_draw_control

    fn pdf_draw_control() -> PdfDrawControl

    Compatibility wrapper for pdf_draw_control_new.

    pdf_draw_control_new

    fn pdf_draw_control_new() -> PdfDrawControl

    Create a fresh cpdf draw-control state with an empty main frame.

    pdf_draw_render_state_new

    fn pdf_draw_render_state_new() -> PdfDrawRenderState

    Build a fresh draw render state with default resource caches.

    pdf_draw_special_text_context

    Build a special-text context from explicit replacement values.

    pdf_draw_special_text_context_for_document

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

    Compatibility wrapper for PdfDocument::draw_special_text_context.

    pdf_drawop_to_content_ops

    Compatibility wrapper for PdfDrawOp::to_content_ops.

    pdf_drawop_to_content_ops_with_context

    Compatibility wrapper for PdfDrawOp::to_content_ops_with_context.

    pdf_drawop_to_content_ops_with_document

    Compatibility wrapper for PdfDrawOp::to_content_ops_with_document.

    pdf_drawop_to_content_ops_with_document_context

    Compatibility wrapper for PdfDrawOp::to_content_ops_with_document_context.

    pdf_drawop_to_content_ops_with_state

    Compatibility wrapper for PdfDrawOp::to_content_ops_with_state.

    pdf_drawops_to_content_ops

    Convert a sequence of cpdf draw operations to flat PDF content operators.

    pdf_drawops_to_content_ops_with_context

    Convert a sequence of cpdf draw operations using state and special-text data.

    pdf_drawops_to_content_ops_with_document

    Convert a sequence of cpdf draw operations using resource state and a document for indirect object allocation.

    pdf_drawops_to_content_ops_with_document_context

    Convert a sequence of cpdf draw operations using document resources and special-text data.

    pdf_drawops_to_content_ops_with_state

    Convert a sequence of cpdf draw operations using resource allocation state.

    pdf_eltinfo

    Source-spelled cpdfdrawcontrol eltinfo over explicit draw state.

    pdf_embed_collate_runs

    fn[A, B : Eq, C] pdf_embed_collate_runs(runs : ArrayView[(A, B, C)]) -> Array[Array[(A, B, C)]]

    Collate consecutive triples by their middle value.

    This is the generic cpdfembed collate_runs behavior. The fontpack-specific wrapper below keeps the older concrete API for existing callers.

    pdf_embed_get_char

    fn pdf_embed_get_char(pack : PdfFontPack, codepoint : Int) -> (Int, Int, PdfFont)?

    Compatibility wrapper matching cpdfembed's get_char.

    pdf_embed_truetype

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

    Compatibility wrapper matching cpdfembed's embed_truetype.

    pdf_encode_filter_bytes

    fn pdf_encode_filter_bytes(filter :
    PdfName
    , data : Bytes) -> Bytes raise
    PdfError

    Encode owned bytes with a single PDF filter name.

    pdf_encode_filter_bytes_with_flate_level

    fn pdf_encode_filter_bytes_with_flate_level(filter :
    PdfName
    , data : Bytes, flate_level : Int) -> Bytes raise
    PdfError

    Encode owned bytes with a single PDF filter name and explicit Flate level.

    pdf_encode_filter_view

    fn pdf_encode_filter_view(filter :
    PdfName
    , data : BytesView) -> Bytes raise
    PdfError

    Encode bytes with a single PDF filter name.

    pdf_encode_filter_view_with_flate_level

    fn pdf_encode_filter_view_with_flate_level(filter :
    PdfName
    , data : BytesView, flate_level : Int) -> Bytes raise
    PdfError

    Encode bytes with a single PDF filter name and explicit Flate level.

    flate_level follows the zlib range accepted by the Flate encoder.

    pdf_encode_output

    Source-spelled compatibility alias for cpdfmetadata's encode_output.

    pdf_encode_predictor

    fn pdf_encode_predictor(predictor : Int, colors : Int, bits_per_component : Int, columns : Int, data : Bytes) -> Bytes raise
    PdfError

    Owned-byte wrapper for pdf_encode_predictor_view.

    Predictor 1 returns the original owned bytes unchanged.

    pdf_encode_predictor_view

    fn pdf_encode_predictor_view(predictor : Int, colors : Int, bits_per_component : Int, columns : Int, data : BytesView) -> Bytes raise
    PdfError

    Encode data with a PDF predictor.

    Predictor 1 is identity, 2 is TIFF horizontal differencing, 10..14 use fixed PNG row filters, and 15 chooses the lowest-scoring PNG filter per row.

    pdf_encode_stream_with_encoding

    fn pdf_encode_stream_with_encoding(encoding : PdfStreamEncoding, object :
    PdfObject
    , only_if_smaller? : Bool, predictor? : PdfStreamPredictor?, predictor_columns? : Int, flate_level? : Int?) ->
    PdfObject
    raise
    PdfError

    Encode a stream using a typed encoding description.

    CCITT encodings write fax /DecodeParms; other encodings may optionally apply a predictor before the filter. CCITT does not accept predictors.

    pdf_encode_stream_with_filter

    Encode a stream object with one filter.

    The new filter is prepended to existing filters and /Length is refreshed. When only_if_smaller is true, the original stream is returned if encoded data is not smaller than the original stream data.

    pdf_encode_stream_with_filter_and_predictor

    fn pdf_encode_stream_with_filter_and_predictor(filter :
    PdfName
    , predictor : Int, colors : Int, bits_per_component : Int, columns : Int, object :
    PdfObject
    , only_if_smaller? : Bool, flate_level? : Int?) ->
    PdfObject
    raise
    PdfError

    Encode a stream after first applying predictor encoding.

    /DecodeParms are added for the predictor, the filter is prepended, and /Length is refreshed. only_if_smaller compares encoded data against the original stream data.

    pdf_encoding_of_name

    fn pdf_encoding_of_name(name :
    PdfName
    ) -> PdfEncoding?

    Recognize a built-in simple-font encoding name.

    pdf_endartifact

    fn pdf_endartifact(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol endartifact over explicit draw state.

    pdf_endeltinfo

    fn pdf_endeltinfo(control : PdfDrawControl, key : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol endeltinfo over explicit draw state.

    pdf_endpage

    fn pdf_endpage(document : PdfDocument) -> Int raise
    PdfError

    Compatibility wrapper for PdfDocument::endpage.

    pdf_endpage_fast

    fn pdf_endpage_fast(document : PdfDocument) -> Int raise
    PdfError

    Compatibility wrapper for PdfDocument::endpage_fast.

    pdf_endstag

    fn pdf_endstag(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol endstag over explicit draw state.

    pdf_endtag

    fn pdf_endtag(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol endtag over explicit draw state.

    pdf_endxobj

    fn pdf_endxobj(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol endxobj over explicit draw state.

    pdf_eval_function

    fn pdf_eval_function(function : PdfFunction, inputs : ArrayView[Double]) -> Array[Double] raise
    PdfError

    Compatibility wrapper for PdfFunction::eval.

    pdf_expand_date

    fn pdf_expand_date(date : String) -> String

    Expand cpdf's metadata date alias.

    This mirrors Cpdfmetadata.expand_date: "now" becomes a PDF date string and all other inputs are returned unchanged. Setting CPDF_REPRODUCIBLE_DATES=true uses the deterministic dummy timestamp.

    pdf_extract_fontfile_bytes

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

    Compatibility wrapper for PdfDocument::extract_fontfile_bytes.

    pdf_fill

    fn pdf_fill(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's fill.

    pdf_fillevenodd

    fn pdf_fillevenodd(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's fillevenodd.

    pdf_find_obj

    Compatibility wrapper matching cpdftweak's find_obj name.

    pdf_find_object

    Compatibility wrapper for PdfDocument::find_object_by_spec.

    pdf_font_from_name

    fn pdf_font_from_name(document : PdfDocument, font_name : String, page_number : Int) ->
    PdfObject
    raise
    PdfError

    Compatibility wrapper for PdfDocument::font_from_name.

    pdf_font_table

    fn pdf_font_table(document : PdfDocument, font_name : String, page_number : Int) -> Array[
    PdfFontTableEntry
    ] raise
    PdfError

    Compatibility wrapper for PdfDocument::font_table.

    pdf_font_table_text

    fn pdf_font_table_text(document : PdfDocument, font_name : String, page_number : Int) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::font_table_text.

    pdf_fontpack_collate_runs

    fn pdf_fontpack_collate_runs(runs : ArrayView[(Int, Int, PdfFont)]) -> Array[Array[(Int, Int, PdfFont)]]

    Collate consecutive (charcode, font_index, font) runs by font index.

    pdf_fontpack_get_char

    fn pdf_fontpack_get_char(pack : PdfFontPack, codepoint : Int) -> (Int, Int, PdfFont)?

    Compatibility wrapper for PdfFontPack::get_char.

    pdf_fontpack_of_standard_font

    fn pdf_fontpack_of_standard_font(font : PdfFont) -> PdfFontPack raise
    PdfError

    Build a font pack for an already parsed standard font.

    Duplicate Unicode mappings follow OCaml Hashtbl.add/find behavior by resolving to the last character code inserted by the 0..255 scan.

    pdf_fontpack_of_standardfont

    fn pdf_fontpack_of_standardfont(font : PdfFont) -> PdfFontPack raise
    PdfError

    Compatibility wrapper matching cpdfembed's fontpack_of_standardfont.

    pdf_fonts_json

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

    Compatibility wrapper for PdfDocument::fonts_json.

    pdf_fonts_json_blob

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

    Compatibility wrapper for PdfDocument::fonts_json_blob.

    pdf_format_real

    fn pdf_format_real(value : Double) -> Bytes raise
    PdfError

    Compatibility alias for pdf_write_real.

    pdf_generate_id

    fn pdf_generate_id(path : String, get_time : () -> Double) ->
    PdfObject

    Generates a PDF trailer /ID array from a path and caller-supplied time source.

    The digest construction follows CamlPDF's path-plus-time behavior. When CAMLPDF_REPRODUCIBLE_IDS=true, the seed is fixed so tests and reproducible builds can produce stable IDs.

    pdf_get_annotations

    Compatibility wrapper for PdfDocument::get_annotations.

    pdf_get_annotations_json

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

    Compatibility wrapper for PdfDocument::annotations_json_blob.

    pdf_get_annotations_json_cpdf_order

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

    Compatibility wrapper matching cpdfannot's get_annotations_json order.

    pdf_get_bookmarks_json

    fn pdf_get_bookmarks_json(json_preserve_actions : Bool, document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::bookmarks_json_blob.

    pdf_get_catalog_item

    fn pdf_get_catalog_item(key :
    PdfName
    , document : PdfDocument) -> String

    Compatibility wrapper for PdfDocument::catalog_item.

    pdf_get_catalog_item_cpdf_order

    fn pdf_get_catalog_item_cpdf_order(key : String, document : PdfDocument) -> String

    Compatibility wrapper matching cpdfmetadata's get_catalog_item.

    pdf_get_catalog_item_string

    fn pdf_get_catalog_item_string(key : String, document : PdfDocument) -> String

    Compatibility wrapper matching cpdfmetadata's string-key get_catalog_item.

    pdf_get_data_for

    fn pdf_get_data_for(xml_uri : String, name : String, tree :
    PdfMetadataXmlTree
    ) -> String?

    Source-spelled compatibility alias for cpdfmetadata's get_data_for.

    pdf_get_dict_entries

    fn pdf_get_dict_entries(document : PdfDocument, key :
    PdfName
    , utf8? : Bool) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::dict_entries_json.

    pdf_get_dict_entries_cpdf_order

    fn pdf_get_dict_entries_cpdf_order(utf8 : Bool, document : PdfDocument, key : String) -> Bytes raise
    PdfError

    Compatibility wrapper matching cpdftweak's get_dict_entries argument order.

    pdf_get_dict_entries_string

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

    Compatibility wrapper matching cpdftweak's string-key get_dict_entries.

    pdf_get_image_24bpp

    Compatibility wrapper for PdfDocument::get_image_24bpp.

    pdf_get_info_utf8

    fn pdf_get_info_utf8(document : PdfDocument, key :
    PdfName
    ) -> String

    Compatibility wrapper for PdfDocument::info_utf8.

    pdf_get_info_utf8_string

    fn pdf_get_info_utf8_string(document : PdfDocument, key : String) -> String

    Compatibility wrapper matching cpdfmetadata's string-key get_info_utf8.

    pdf_get_mark_info_item

    fn pdf_get_mark_info_item(key :
    PdfName
    , document : PdfDocument) -> Bool

    Compatibility wrapper for PdfDocument::mark_info_item.

    pdf_get_metadata

    fn pdf_get_metadata(document : PdfDocument) -> Bytes? raise
    PdfError

    Compatibility wrapper for PdfDocument::metadata.

    pdf_get_open_action

    Compatibility wrapper for PdfDocument::open_action.

    pdf_get_open_action_json_blob

    fn pdf_get_open_action_json_blob(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::open_action_json_blob.

    pdf_get_open_action_string

    fn pdf_get_open_action_string(document : PdfDocument) -> String raise
    PdfError

    Compatibility wrapper for PdfDocument::open_action_string.

    pdf_get_viewer_pref_item

    fn pdf_get_viewer_pref_item(key :
    PdfName
    , document : PdfDocument) -> String

    Compatibility wrapper for PdfDocument::viewer_preference_item.

    pdf_get_viewer_pref_item_cpdf_order

    fn pdf_get_viewer_pref_item_cpdf_order(key : String, document : PdfDocument) -> String

    Compatibility wrapper matching cpdfmetadata's get_viewer_pref_item.

    pdf_get_viewer_pref_item_string

    fn pdf_get_viewer_pref_item_string(key : String, document : PdfDocument) -> String

    Compatibility wrapper matching cpdfmetadata's string-key get_viewer_pref_item.

    pdf_get_xmp_info

    fn pdf_get_xmp_info(document : PdfDocument, key :
    PdfName
    ) -> String

    Compatibility wrapper for PdfDocument::xmp_info.

    pdf_get_xmp_info_string

    fn pdf_get_xmp_info_string(document : PdfDocument, key : String) -> String

    Compatibility wrapper matching cpdfmetadata's string-key get_xmp_info.

    pdf_getfontname

    fn pdf_getfontname(control : PdfDrawControl) -> String

    Source-spelled cpdfdrawcontrol getfontname over explicit draw state.

    pdf_getfontsize

    fn pdf_getfontsize(control : PdfDrawControl) -> Double

    Source-spelled cpdfdrawcontrol getfontsize over explicit draw state.

    pdf_getindent

    fn pdf_getindent(control : PdfDrawControl) -> Double?

    Source-spelled cpdfdrawcontrol getindent over explicit draw state.

    pdf_glyphnames_of_text

    fn pdf_glyphnames_of_text(extractor : PdfTextExtractor, text : BytesView) -> Array[
    PdfName
    ] raise
    PdfError

    Compatibility wrapper for PdfTextExtractor::glyphnames_of_text.

    pdf_gpc_polygon_of_box

    fn pdf_gpc_polygon_of_box(xmin : Double, xmax : Double, ymin : Double, ymax : Double) -> PdfClipPolygon

    Source-spelled compatibility wrapper for cpdfclip's rectangle polygon.

    pdf_gpcml_clippolygon

    fn pdf_gpcml_clippolygon(operation : PdfClipOperation, subject : PdfClipPolygon, clip : PdfClipPolygon) -> PdfClipPolygon raise
    PdfError

    Source-spelled compatibility wrapper for cpdfclip's native clip operation.

    pdf_gpcml_printpolygon

    fn pdf_gpcml_printpolygon(polygon : PdfClipPolygon) -> Bytes

    Return the text cpdfclip's debug polygon printer writes to stdout.

    pdf_hard_box

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

    Compatibility wrapper for PdfDocument::hard_box.

    pdf_hard_box_string

    fn pdf_hard_box_string(document : 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.

    pdf_hasbox

    fn pdf_hasbox(document : PdfDocument, page_number : Int, box_name :
    PdfName
    ) -> Bool raise
    PdfError

    Compatibility wrapper for PdfDocument::has_page_box.

    pdf_hasbox_string

    fn pdf_hasbox_string(document : PdfDocument, page_number : Int, box_name : String) -> Bool raise
    PdfError

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

    pdf_hflip_pdf

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

    Compatibility wrapper for PdfDocument::flip_pages_horizontally.

    pdf_image_bpc

    Compatibility wrapper for PdfDocument::bpc.

    pdf_image_colspace

    Compatibility wrapper for PdfDocument::colspace.

    pdf_image_debug_image_processing

    fn pdf_image_debug_image_processing() -> Bool

    Return cpdfimage's debug_image_processing flag.

    pdf_image_document_of_jbig2_data

    fn pdf_image_document_of_jbig2_data(data : BytesView, global? : BytesView?, process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Build a single-page PDF document from JBIG2 data.

    pdf_image_document_of_jpeg2000_data

    fn pdf_image_document_of_jpeg2000_data(data : BytesView, process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Build a single-page PDF document from JPEG2000 data.

    pdf_image_document_of_jpeg_data

    fn pdf_image_document_of_jpeg_data(data : BytesView, process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Build a single-page PDF document from JPEG data.

    pdf_image_document_of_object

    fn pdf_image_document_of_object(image :
    PdfObject
    , process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Build a single-page PDF document that draws image at its natural size.

    pdf_image_document_of_png_data

    fn pdf_image_document_of_png_data(data : BytesView, process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Build a single-page PDF document from PNG data.

    pdf_image_extract_images_files

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

    Compatibility wrapper for PdfDocument::extract_images_files.

    pdf_image_extract_single_image_files

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

    Compatibility wrapper for PdfDocument::extract_single_image_files.

    pdf_image_images

    fn pdf_image_images(inline : Bool, document : PdfDocument, page_numbers : ArrayView[Int]) -> Json raise
    PdfError

    Compatibility wrapper for PdfDocument::images_json.

    pdf_image_images_json_blob

    fn pdf_image_images_json_blob(inline : Bool, document : PdfDocument, page_numbers : ArrayView[Int]) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::images_json_blob.

    pdf_image_obj_of_jbig2_data

    fn pdf_image_obj_of_jbig2_data(data : BytesView, global? : BytesView?) -> (
    PdfObject
    , Array[(Int,
    PdfObject
    )]) raise
    PdfError

    Compatibility wrapper matching cpdfimage's obj_of_jbig2_data.

    pdf_image_obj_of_jpeg2000_data

    Compatibility wrapper matching cpdfimage's obj_of_jpeg2000_data result shape.

    pdf_image_obj_of_jpeg_data

    fn pdf_image_obj_of_jpeg_data(data : BytesView, path_to_im? : String) -> (
    PdfObject
    , Array[(Int,
    PdfObject
    )]) raise
    PdfError

    Compatibility wrapper matching cpdfimage's obj_of_jpeg_data result shape.

    pdf_image_obj_of_png_data

    Compatibility wrapper matching cpdfimage's obj_of_png_data result shape.

    pdf_image_object_of_jbig2_data

    fn pdf_image_object_of_jbig2_data(data : BytesView, global? : BytesView?) -> (
    PdfObject
    , Array[(Int,
    PdfObject
    )]) raise
    PdfError

    Build a PDF image XObject for JBIG2 data.

    When global is supplied, the returned extra object list contains the /JBIG2Globals stream at object number 10000, matching cpdf's standalone obj_of_jbig2_data contract.

    pdf_image_object_of_jpeg2000_data

    fn pdf_image_object_of_jpeg2000_data(data : BytesView) ->
    PdfObject
    raise
    PdfError

    Build a PDF image XObject for JPEG2000 data.

    pdf_image_object_of_jpeg_data

    fn pdf_image_object_of_jpeg_data(data : BytesView) ->
    PdfObject
    raise
    PdfError

    Build a PDF image XObject for JPEG data.

    pdf_image_object_of_png_data

    fn pdf_image_object_of_png_data(document : PdfDocument, data : BytesView) ->
    PdfObject
    raise
    PdfError

    Build a PDF image XObject for PNG data using document for any alpha mask object that must be added.

    pdf_image_of_input

    fn pdf_image_of_input(data : BytesView, object_of_data : (PdfDocument, BytesView) -> (
    PdfObject
    , Array[(Int,
    PdfObject
    )]) raise
    PdfError
    , process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfimage's image_of_input.

    The input side is represented by a byte view instead of Pdfio.input; object_of_data receives the document so PNG masks and similar side objects can be added through the same document before the page is built.

    pdf_image_resolution

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

    Compatibility wrapper for PdfDocument::image_resolution.

    pdf_image_resolution_json

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

    Compatibility wrapper for PdfDocument::image_resolution_json.

    pdf_image_resolution_json_blob

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

    Compatibility wrapper for PdfDocument::image_resolution_json_blob.

    pdf_image_set_debug_image_processing

    fn pdf_image_set_debug_image_processing(enabled : Bool) -> Unit

    Set cpdfimage's debug_image_processing flag.

    pdf_images

    fn pdf_images(inline : Bool, document : PdfDocument, page_numbers : ArrayView[Int]) -> Json raise
    PdfError

    Source-spelled compatibility wrapper for cpdfimage's images.

    pdf_impose

    fn pdf_impose(document : 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

    Compatibility wrapper for PdfDocument::impose.

    pdf_is_identity_h

    fn pdf_is_identity_h(font : PdfFont) -> Bool

    Compatibility wrapper for PdfFont::is_identity_h.

    pdf_is_linearized

    fn pdf_is_linearized(data : BytesView) -> Bool

    Return whether the input appears to be a linearized PDF.

    The check reads the first indirect object after the header and looks for a numeric /Linearized entry. Parse failures are treated as false.

    pdf_is_unicode_string

    fn pdf_is_unicode_string(bytes : BytesView) -> Bool

    Test whether a PDF string starts with the UTF-16BE byte-order mark.

    PDF "Unicode strings" are byte strings beginning with FE FF; the input is intentionally a BytesView rather than a MoonBit String.

    pdf_is_xfa

    fn pdf_is_xfa(document : PdfDocument) -> Bool

    Compatibility wrapper for PdfDocument::is_xfa.

    pdf_iter_pages

    fn pdf_iter_pages(document : PdfDocument, page_numbers : ArrayView[Int], process : (Int,
    PdfPage
    ) -> Unit raise
    PdfError
    ) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::iter_pages.

    pdf_iter_pages_cpdf_order

    fn pdf_iter_pages_cpdf_order(process : (Int,
    PdfPage
    ) -> Unit raise
    PdfError
    , document : PdfDocument, page_numbers : ArrayView[Int]) -> Unit raise
    PdfError

    Compatibility wrapper matching cpdfpage's iter_pages argument order.

    pdf_jpeg2000_dimensions

    fn pdf_jpeg2000_dimensions(data : Bytes) -> (Int, Int) raise
    PdfError

    Return the width and height of a JPEG2000 JP2/JPX byte stream.

    pdf_jpeg2000_dimensions_view

    fn pdf_jpeg2000_dimensions_view(data : BytesView) -> (Int, Int) raise
    PdfError

    Return the width and height of a JPEG2000 JP2/JPX byte stream.

    The scan follows cpdf's byte-by-byte search for the ihdr image header box.

    pdf_json_fonts

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

    Compatibility wrapper matching cpdffont's json_fonts.

    pdf_json_of_document

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

    Compatibility wrapper for PdfDocument::json_of_document.

    pdf_json_of_document_blob

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

    Compatibility wrapper for PdfDocument::json_of_document_blob.

    pdf_json_of_object

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

    Compatibility wrapper for PdfDocument::json_of_object.

    pdf_json_page_info

    fn pdf_json_page_info(document : PdfDocument, page_numbers : ArrayView[Int], unit :
    PdfUnit
    ) -> Json raise
    PdfError

    Compatibility wrapper matching cpdfpage's json_page_info.

    pdf_json_to_output

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

    Compatibility wrapper for PdfDocument::json_to_output.

    pdf_language

    fn pdf_language(document : PdfDocument) -> Bytes?

    Compatibility wrapper for PdfDocument::language.

    pdf_language_string

    fn pdf_language_string(document : PdfDocument) -> String?

    Compatibility wrapper returning /Lang as cpdf-style text.

    pdf_list_annotations

    fn pdf_list_annotations(page_numbers : ArrayView[Int], encoding :
    PdfMetadataEncoding
    , document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::list_annotations.

    pdf_list_attached_files

    Compatibility wrapper for PdfDocument::list_attached_files.

    pdf_list_bookmarks

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

    Compatibility wrapper for PdfDocument::list_bookmarks.

    pdf_list_fonts

    Compatibility wrapper for PdfDocument::list_fonts.

    pdf_list_fonts_text

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

    Compatibility wrapper for PdfDocument::list_fonts_text.

    pdf_list_spot_colours

    fn pdf_list_spot_colours(document : PdfDocument) -> Array[
    PdfName
    ]

    Compatibility wrapper for PdfDocument::list_spot_colours.

    pdf_list_spot_colours_blob

    fn pdf_list_spot_colours_blob(document : PdfDocument) -> Bytes

    Compatibility wrapper for PdfDocument::list_spot_colours_blob.

    pdf_make_font

    Build a simple Type 1 font dictionary for a base font and named encoding.

    Only encodings with a direct PDF name can be written this way; custom or implicit encodings raise @core.PdfError::EncodingWriteUnsupported.

    pdf_make_gpcpolygon

    fn pdf_make_gpcpolygon(holes : ArrayView[Bool], vertex_arrays : ArrayView[Array[PdfClipVertex]]) -> PdfClipPolygon raise
    PdfError

    Source-spelled compatibility wrapper for cpdfclip's polygon builder.

    pdf_make_hex_pdf_string

    fn pdf_make_hex_pdf_string(bytes : BytesView) -> Bytes

    Compatibility alias for pdf_write_hex_string.

    pdf_make_pdf_string

    fn pdf_make_pdf_string(bytes : BytesView) -> Bytes

    Compatibility alias for pdf_write_literal_string.

    pdf_map_pages

    Compatibility wrapper for PdfDocument::map_pages.

    pdf_map_pages_cpdf_order

    fn[T] pdf_map_pages_cpdf_order(process : (Int,
    PdfPage
    ) -> T raise
    PdfError
    , document : PdfDocument, page_numbers : ArrayView[Int]) -> Array[T] raise
    PdfError

    Compatibility wrapper matching cpdfpage's map_pages argument order.

    pdf_mark_all_as_artifact

    fn pdf_mark_all_as_artifact(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::mark_all_as_artifact.

    pdf_merge_documents

    fn pdf_merge_documents(documents : ArrayView[PdfDocument], ranges : ArrayView[Array[Int]], retain_numbering? : Bool, retain_bookmarks? : Bool, retain_optional_content? : Bool, retain_acroforms? : Bool, retain_named_destinations? : Bool, retain_name_dictionary? : Bool, retain_structure_tree? : Bool, add_toplevel_document? : Bool, retain_info? : Bool, retain_catalog_entries? : Bool, remove_duplicate_fonts? : Bool) -> PdfDocument raise
    PdfError

    Merges selected page ranges from multiple documents into one document.

    Each entry in ranges belongs to the document at the same index and uses one-based page numbers. The retain flags control whether numbering, bookmarks, optional-content data, AcroForms, named destinations, name dictionary entries, structure trees, info dictionaries, and catalog entries are copied into the output. Raises @core.PdfError::PageTreeExpected when the document and range lists do not align.

    pdf_merge_name_trees_no_clash

    Compatibility wrapper for PdfDocument::merge_name_trees_no_clash.

    pdf_merge_number_trees_no_clash

    Compatibility wrapper for PdfDocument::merge_number_trees_no_clash.

    pdf_merge_pdfs

    fn pdf_merge_pdfs(retain_numbering : Bool, remove_duplicate_fonts : Bool, names : ArrayView[String], documents : ArrayView[PdfDocument], ranges : ArrayView[Array[Int]], process_struct_trees? : Bool, add_toplevel_document? : Bool) -> PdfDocument raise
    PdfError

    CamlPDF-shaped convenience wrapper for merging PDFs.

    names must have the same length as documents; it is retained for API compatibility with CamlPDF's merge entry point. Structure-tree processing and optional top-level /Document wrapping are controlled by the optional flags.

    pdf_merge_structure_trees

    fn pdf_merge_structure_trees(document : PdfDocument, documents : ArrayView[PdfDocument], add_toplevel_document? : Bool) -> Int? raise
    PdfError

    Merge structure tree roots from source documents into a target document.

    Returns the resulting structure-tree root object number, or None when no source document has a structure tree. When multiple roots are merged, parent trees and root metadata are combined in document; add_toplevel_document wraps merged children in a PDF 2.0 top-level /Document structure element.

    pdf_metadata_bytes_of_xmltree

    fn pdf_metadata_bytes_of_xmltree(document :
    PdfMetadataXmlDocument
    ) -> Bytes

    Serialize a metadata XML-tree document to UTF-8 XML bytes.

    Like cpdfmetadata's bytes_of_xmltree, this omits an XML declaration.

    pdf_metadata_encode_output

    fn pdf_metadata_encode_output(encoding :
    PdfMetadataEncoding
    , bytes : BytesView) -> Bytes raise
    PdfError

    Encode a PDF string for metadata/reporting output.

    pdf_metadata_get_data_for_bytes

    fn pdf_metadata_get_data_for_bytes(xml_uri : String, name : String, metadata : BytesView) -> String?

    Return the first XMP metadata value matching an XML namespace URI and local name. This is the tree-free counterpart of cpdfmetadata's get_data_for, covering namespace aliases, attributes, simple element text, and RDF lists.

    pdf_metadata_string_of_xmltree

    fn pdf_metadata_string_of_xmltree(tree :
    PdfMetadataXmlTree
    ) -> String

    Return cpdfmetadata's debug string representation for an XML tree.

    pdf_metadata_xmltree_get_data_for

    fn pdf_metadata_xmltree_get_data_for(xml_uri : String, name : String, tree :
    PdfMetadataXmlTree
    ) -> String?

    Return the first XML-tree value matching a namespace URI and local name, following cpdfmetadata's get_data_for tree traversal.

    pdf_metadata_xmltree_of_bytes

    Parse metadata XML bytes into a cpdfmetadata-style XML tree.

    This parser is intentionally scoped to the XML/XMP subset used by PDF metadata: elements, attributes, namespaces, comments, processing instructions, optional DTD text, text data, and predefined or numeric XML entities.

    pdf_minimum_valid_pdf

    fn pdf_minimum_valid_pdf() -> PdfDocument raise
    PdfError

    Build the smallest useful PDF document: one blank A4 page and a catalog.

    pdf_missing_fonts

    Compatibility wrapper for PdfDocument::missing_fonts.

    pdf_missing_fonts_return

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

    Compatibility wrapper for PdfDocument::missing_fonts_return.

    pdf_missing_fonts_text

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

    Compatibility wrapper for PdfDocument::missing_fonts_text.

    pdf_name_of_colour_space

    fn pdf_name_of_colour_space(space : PdfColourSpace) ->
    PdfName
    ?

    Compatibility wrapper for PdfColourSpace::name.

    pdf_name_of_spec

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

    Source-spelled compatibility wrapper for cpdfbookmarks' name_of_spec.

    pdf_nullpoly

    fn pdf_nullpoly() -> PdfClipPolygon

    Source-spelled compatibility wrapper for cpdfclip's null GPC polygon.

    pdf_obj_of_jbig2_data

    Source-spelled cpdfimage obj_of_jbig2_data wrapper.

    pdf_obj_of_jpeg2000_data

    Source-spelled cpdfimage obj_of_jpeg2000_data wrapper.

    pdf_obj_of_jpeg_data

    Source-spelled cpdfimage obj_of_jpeg_data wrapper.

    pdf_obj_of_png_data

    Source-spelled cpdfimage obj_of_png_data wrapper.

    pdf_object_entry

    fn pdf_object_entry(data : PdfObjectData, generation? : Int) -> PdfObjectEntry

    Construct an object-table entry.

    The generation defaults to 0, matching newly created PDF objects.

    pdf_object_map_empty

    fn pdf_object_map_empty() -> PdfObjectMap

    Construct an empty object-number map.

    pdf_object_of_colour_space

    fn pdf_object_of_colour_space(space : PdfColourSpace) ->
    PdfObject
    ?

    Convert a parsed colour space back into a PDF object.

    Returns None when the colour space cannot be serialized losslessly, such as an indexed table with invalid component values or a base colour space that itself cannot be represented.

    pdf_object_of_date

    Formats a PDF date as a PdfString object.

    Raises @core.PdfError::BadDate if any field is outside the representable PDF date ranges.

    pdf_object_of_destination

    Converts a normalized destination back to a PDF object.

    pdf_object_of_function

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

    Compatibility wrapper for PdfDocument::pdf_object_of_function.

    pdf_object_of_json

    Convert a single CPDFJSON object to a PDF object.

    This ports the ordinary object side of cpdf's object_of_json: primitive JSON values, CPDFJSON integer/real/name/string wrappers, dictionaries, arrays, indirect references, streams with embedded string data, and streams with parsed content-operation arrays are supported.

    pdf_object_of_matrix

    Convert a transformation matrix into its six-number PDF array form.

    pdf_objects_empty

    fn pdf_objects_empty() -> PdfObjects

    Construct an empty document object table.

    The next allocated object number will be 1; the mutation log starts empty.

    pdf_objects_of_entries

    fn pdf_objects_of_entries(entries : ArrayView[(Int, PdfObjectEntry)]) -> PdfObjects

    Build a document object table from explicit numbered entries.

    Entries are installed without recording alteration events. The maximum object number is derived from the supplied numbers.

    pdf_ocg_coalesce

    fn pdf_ocg_coalesce(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_coalesce.

    pdf_ocg_get_list

    fn pdf_ocg_get_list(document : PdfDocument) -> Array[Bytes] raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_get_list.

    pdf_ocg_list

    fn pdf_ocg_list(json : Bool, document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper matching cpdfocg's ocg_list.

    pdf_ocg_list_json

    fn pdf_ocg_list_json(document : PdfDocument) -> Json raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_list_json.

    pdf_ocg_list_json_blob

    fn pdf_ocg_list_json_blob(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_list_json_blob.

    pdf_ocg_order_all

    fn pdf_ocg_order_all(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_order_all.

    pdf_ocg_read_json

    Parse cpdf's optional-content group JSON representation.

    pdf_ocg_rename

    fn pdf_ocg_rename(old_name : Bytes, new_name : Bytes, document : PdfDocument) -> PdfDocument

    Compatibility wrapper for PdfDocument::ocg_rename.

    pdf_ocg_replace_json

    fn pdf_ocg_replace_json(json : Json, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::ocg_replace_json.

    pdf_of_pages

    fn pdf_of_pages(document : PdfDocument, page_numbers : ArrayView[Int], retain_numbering? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::pdf_of_pages.

    pdf_optional_content_merge

    Merge optional-content metadata from already-renumbered documents.

    Documents without optional content are skipped. Indirect object numbers are copied as-is into the merged result, so callers must renumber source documents before merging when object numbers may collide.

    pdf_output_info

    Compatibility wrapper for PdfDocument::info_blob.

    pdf_output_info_json_blob

    Compatibility wrapper for PdfDocument::info_json_blob.

    pdf_output_page_info

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

    Compatibility wrapper matching cpdfpage's output_page_info argument order.

    pdf_output_page_info_json_blob

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

    Compatibility wrapper for PdfDocument::page_info_json_blob.

    pdf_output_page_info_text

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

    Compatibility wrapper for PdfDocument::page_info_text.

    pdf_output_xmp_info

    Compatibility wrapper for PdfDocument::xmp_info_blob.

    pdf_output_xmp_info_json_blob

    fn pdf_output_xmp_info_json_blob(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::xmp_info_json_blob.

    pdf_pad_after

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

    Compatibility wrapper for PdfDocument::pad_after.

    pdf_pad_before

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

    Compatibility wrapper for PdfDocument::pad_before.

    pdf_pad_to_multiple

    fn pdf_pad_to_multiple(document : PdfDocument, multiple : Int) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::pad_to_multiple.

    pdf_padafter

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

    Source-spelled cpdfpad padafter wrapper with cpdf argument order.

    pdf_padbefore

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

    Source-spelled cpdfpad padbefore wrapper with cpdf argument order.

    pdf_padmultiple

    fn pdf_padmultiple(multiple : Int, document : PdfDocument) -> PdfDocument raise
    PdfError

    Source-spelled cpdfpad padmultiple wrapper with cpdf argument order.

    pdf_page_content_json

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

    Compatibility wrapper for PdfDocument::page_content_json.

    pdf_page_info_json

    fn pdf_page_info_json(document : PdfDocument, page_numbers : ArrayView[Int], unit? :
    PdfUnit
    ) -> Json raise
    PdfError

    Compatibility wrapper for PdfDocument::page_info_json.

    pdf_page_label_add_label

    Insert or replace a label range over a page interval.

    Existing ranges after range_end_page are preserved, and a continuation range is inserted when needed so later labels keep their previous numbering.

    pdf_page_label_coalesce

    Collapse adjacent page-label ranges that produce the same numbering stream.

    Ranges are merged only when their style, prefix, and start_page -start_value offset are identical, so visible labels for every page remain unchanged.

    pdf_page_label_merge

    Merge page labels for selected pages from several source documents.

    ranges contains 1-based source page numbers for each document. The merged result preserves the visible labels from those source pages at their new concatenated positions and coalesces adjacent equivalent ranges.

    Raises if the document and range arrays have different lengths, or if a source document's page-label tree cannot be read.

    pdf_page_object_number

    fn pdf_page_object_number(document : PdfDocument, page_number : Int) -> Int? raise
    PdfError

    Compatibility wrapper for PdfDocument::page_object_number.

    pdf_page_process_stub

    fn[A, B, C] pdf_page_process_stub(process : (A, B) -> C raise, number : A, page : B) -> (C, A,
    TransformMatrix
    ) raise

    Adapter for callbacks that process page-like values and return identity geometry.

    This preserves the CamlPDF callback shape by returning the callback result, original number, and identity transform matrix.

    pdf_page_protect

    Return balancing graphics-state operators for an existing operator list.

    If the list contains more q saves than Q restores, matching restores are returned. Otherwise the result is empty.

    pdf_page_reference_numbers

    fn pdf_page_reference_numbers(document : PdfDocument) -> Array[Int] raise
    PdfError

    Compatibility wrapper for PdfDocument::page_reference_numbers.

    pdf_pagenumber_of_target

    Compatibility wrapper for PdfDocument::page_number_of_target.

    pdf_pages_of_pagetree

    Compatibility wrapper for PdfDocument::pages_of_pagetree.

    pdf_parse_bookmark_file

    fn pdf_parse_bookmark_file(verify : Bool, document : PdfDocument, data : BytesView) -> Array[
    PdfBookmark
    ] raise
    PdfError

    Compatibility wrapper matching cpdfbookmarks' plain parse_bookmark_file.

    pdf_parse_bookmark_json

    fn pdf_parse_bookmark_json(verify : Bool, json : Json, document : PdfDocument) -> Array[
    PdfBookmark
    ] raise
    PdfError

    Compatibility wrapper for PdfDocument::parse_bookmark_json.

    pdf_parse_bookmark_text

    fn pdf_parse_bookmark_text(verify : Bool, data : BytesView, document : PdfDocument) -> Array[
    PdfBookmark
    ] raise
    PdfError

    Compatibility wrapper for PdfDocument::parse_bookmark_text.

    pdf_parse_cmap

    Compatibility wrapper for PdfDocument::parse_cmap.

    pdf_parse_cmap_data

    fn pdf_parse_cmap_data(data : BytesView) -> PdfParsedCMap

    Parse raw CMap or ToUnicode bytes into mapping tables and metadata.

    The parser accepts common CMap sections such as code-space ranges, bfchar/bfrange, CID ranges, notdef ranges, /UseCMap, /WMode, and CID-system metadata. Unrecognized or malformed sections are skipped rather than causing a document-level failure.

    pdf_parse_content_ops_from_bytes

    Parse standalone content bytes without document or resource context.

    This is suitable for ordinary operators and inline images that can be read from explicit length or filter markers. Use the document methods when stream decoding or resource-based inline-image sizing is required.

    pdf_parse_content_ops_from_view

    Parse a standalone content byte view without document or resource context.

    pdf_parse_coordinate

    Function wrapper for PdfDocument::parse_coordinate.

    pdf_parse_coordinate_rectangle

    Function wrapper for PdfDocument::parse_coordinate_rectangle.

    pdf_parse_coordinate_rectangles

    Function wrapper for PdfDocument::parse_coordinate_rectangles.

    pdf_parse_coordinate_tuple

    fn pdf_parse_coordinate_tuple(document : PdfDocument, text : String) -> (Double, Double) raise
    PdfError

    Compatibility wrapper matching cpdfcoord's tuple-shaped parse_coordinate.

    pdf_parse_coordinates

    Function wrapper for PdfDocument::parse_coordinates.

    pdf_parse_coordinates_tuple

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

    Compatibility wrapper matching cpdfcoord's tuple-shaped parse_coordinates.

    pdf_parse_flate_unicode_data

    Decode cpdf's flate-compressed UnicodeData source bytes, then parse rows.

    pdf_parse_function

    Compatibility wrapper for PdfDocument::parse_function.

    pdf_parse_pagespec

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

    Source-spelled wrapper for PdfDocument::parse_pagespec.

    pdf_parse_rectangle

    fn pdf_parse_rectangle(document : PdfDocument, text : String) -> (Double, Double, Double, Double) raise
    PdfError

    Compatibility wrapper matching cpdfcoord's parse_rectangle.

    pdf_parse_rectangles

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

    Compatibility wrapper matching cpdfcoord's parse_rectangles.

    pdf_parse_single_number

    fn pdf_parse_single_number(document : PdfDocument, text : String) -> Double raise
    PdfError

    Function wrapper for PdfDocument::parse_single_number.

    pdf_parse_stream_object_from_bytes

    Parse a single indirect stream object from owned bytes.

    The input should contain one indirect-object header, a stream dictionary, stream data, endstream, and endobj.

    pdf_parse_stream_object_from_view

    Parse a single indirect stream object from a borrowed byte view.

    Malformed /Length values are recovered by scanning to endstream when possible, matching the stream recovery used by the primitive reader.

    pdf_parse_unicode_data

    Parse UnicodeData.txt bytes into cpdf-compatible rows.

    pdf_parse_units_string

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

    Function wrapper for PdfDocument::parse_units_string.

    pdf_path_content_bounding_box

    fn pdf_path_content_bounding_box(path :
    PdfPath
    , ctm :
    TransformMatrix
    , line_width : Double, stroking : Bool) -> PdfContentBoundingBox?

    Return cpdfcontent's emitted path bounding-box quad.

    The path is first transformed by the current transformation matrix. When stroking is true, the transformed line-width vector expands the box by half its absolute x/y displacement, matching emit_path_bounding_box.

    pdf_pdfdocencoding_byte_of_codepoint

    fn pdf_pdfdocencoding_byte_of_codepoint(codepoint : Int) -> Byte?

    Return the PDFDocEncoding byte for a Unicode codepoint, if representable.

    The lookup preserves CamlPDF compatibility for the fi ligature by mapping U+FB01 to byte 0x93.

    pdf_pdfdocencoding_of_codepoints

    fn pdf_pdfdocencoding_of_codepoints(codepoints : ArrayView[Int]) -> Bytes?

    Encode codepoints as PDFDocEncoding when every scalar is representable.

    Returns None instead of falling back to UTF-16BE; use pdf_pdfdocstring_of_codepoints for the PDF string policy fallback.

    pdf_pdfdocstring_of_codepoints

    fn pdf_pdfdocstring_of_codepoints(codepoints : ArrayView[Int]) -> Bytes raise
    PdfError

    Encode codepoints as a PDF string.

    PDFDocEncoding is used when all codepoints are representable; otherwise the result is a BOM-prefixed UTF-16BE string.

    pdf_pdfdocstring_of_utf8

    fn pdf_pdfdocstring_of_utf8(bytes : BytesView) -> Bytes raise
    PdfError

    Convert UTF-8 bytes to the compact PDF string representation.

    The result uses PDFDocEncoding when possible and UTF-16BE otherwise.

    pdf_pop

    Source-spelled cpdfdrawcontrol pop over explicit draw state.

    pdf_portfolio

    Compatibility wrapper for PdfDocument::portfolio.

    pdf_postpend_operators

    Compatibility wrapper for PdfDocument::postpend_operators.

    pdf_prepend_operators

    Compatibility wrapper for PdfDocument::prepend_operators.

    pdf_presentation

    fn pdf_presentation(range : ArrayView[Int], transition : String?, delay : Double?, horizontal : Bool, inward : Bool, direction : Int, effect_duration : Double, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::presentation.

    pdf_print_dict_entry

    Compatibility wrapper for PdfDocument::dict_entry_rendered_values.

    pdf_print_dict_entry_cpdf_order

    fn pdf_print_dict_entry_cpdf_order(utf8 : Bool, document : PdfDocument, key : String) -> Array[Bytes] raise
    PdfError

    Compatibility wrapper matching cpdftweak's print_dict_entry argument order.

    pdf_print_dict_entry_string

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

    Compatibility wrapper matching cpdftweak's string-key print_dict_entry.

    pdf_print_font_table

    fn pdf_print_font_table(document : PdfDocument, font_name : String, page_number : Int) -> Bytes raise
    PdfError

    Compatibility wrapper matching cpdffont's print_font_table.

    pdf_print_fonts

    fn pdf_print_fonts(document : PdfDocument, page_numbers : ArrayView[Int], json? : Bool) -> Bytes raise
    PdfError

    Compatibility wrapper matching cpdffont's print_fonts.

    pdf_print_function

    fn pdf_print_function(function : PdfFunction) -> Unit

    Print the function's diagnostic representation to standard output.

    pdf_print_metadata

    fn pdf_print_metadata(document : PdfDocument) -> Bytes raise
    PdfError

    Return the bytes cpdfmetadata's print_metadata would write to stdout.

    pdf_print_pdf_objs

    fn pdf_print_pdf_objs(document : PdfDocument) -> Bytes raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdebug's printed object dump.

    pdf_print_tree_to_buffer

    fn[T] pdf_print_tree_to_buffer(output :
    Buffer
    , value : T, get_name : (T) -> String, get_children : (T) -> Array[T], line_prefix? : String) -> Unit

    Render a tree to an existing buffer using cpdf's line-drawing layout.

    pdf_print_tree_to_string

    fn[T] pdf_print_tree_to_string(value : T, get_name : (T) -> String, get_children : (T) -> Array[T], line_prefix? : String) -> String

    Render a tree to a string using cpdf's line-drawing layout.

    get_name returns the label for a node, and get_children returns its children in display order. line_prefix is prepended to every rendered line.

    pdf_printtree_to_buffer

    fn[T] pdf_printtree_to_buffer(output :
    Buffer
    , value : T, get_name : (T) -> String, get_children : (T) -> Array[T], line_prefix? : String) -> Unit

    Module-spelled compatibility wrapper for cpdfprinttree's to_buffer.

    pdf_printtree_to_string

    fn[T] pdf_printtree_to_string(value : T, get_name : (T) -> String, get_children : (T) -> Array[T], line_prefix? : String) -> String

    Module-spelled compatibility wrapper for cpdfprinttree's to_string.

    pdf_process_pages

    Compatibility wrapper for PdfDocument::process_pages.

    pdf_process_pages_cpdf_order

    Compatibility wrapper matching cpdfpage's process_pages argument order.

    pdf_process_text

    fn pdf_process_text(time :
    PdfStrftimeTime
    , text : String, replacements : ArrayView[(String, () -> String)]) -> String

    Compatibility wrapper matching cpdfaddtext's process_text.

    pdf_progress

    fn pdf_progress() -> Bool

    Return whether progress output capture is enabled.

    pdf_progress_done

    fn pdf_progress_done() -> Unit

    Emit the final progress newline when progress is enabled.

    pdf_progress_endpage

    fn pdf_progress_endpage() -> Unit

    Emit an end-page progress marker when progress is enabled.

    pdf_progress_line

    fn pdf_progress_line(text : String) -> Unit

    Emit a progress line followed by a newline when progress is enabled.

    pdf_progress_line_no_end

    fn pdf_progress_line_no_end(text : String) -> Unit

    Emit progress text without a trailing newline when progress is enabled.

    pdf_progress_output

    fn pdf_progress_output() -> String

    Return all captured progress output as one string.

    pdf_progress_page

    fn pdf_progress_page(page : Int) -> Unit

    Emit a page number fragment when progress is enabled.

    pdf_push

    fn pdf_push(control : PdfDrawControl) -> Unit

    Source-spelled cpdfdrawcontrol push over explicit draw state.

    pdf_read_bookmarks

    Compatibility wrapper for PdfDocument::read_bookmarks.

    pdf_read_classic_document_from_bytes

    fn pdf_read_classic_document_from_bytes(data : Bytes) -> PdfDocument raise
    PdfError

    Read a classic-xref PDF from owned bytes.

    pdf_read_classic_document_from_view

    fn pdf_read_classic_document_from_view(data : BytesView) -> PdfDocument raise
    PdfError

    Read a PDF using classic xref metadata.

    This strict reader follows startxref, xref tables/streams, and trailer /Prev links, loads referenced objects, resolves object streams, and records document metadata. It does not use reconstruction fallback.

    pdf_read_classic_document_revision_from_bytes

    fn pdf_read_classic_document_revision_from_bytes(data : Bytes, revision : Int) -> PdfDocument raise
    PdfError

    Read one classic-xref document revision from owned bytes.

    pdf_read_classic_document_revision_from_view

    fn pdf_read_classic_document_revision_from_view(data : BytesView, revision : Int) -> PdfDocument raise
    PdfError

    Read one classic-xref document revision.

    Revision 1 is the newest revision; larger revision numbers select older revisions by following trailer /Prev links. Invalid or unavailable revisions raise @core.PdfError::BadRevision.

    pdf_read_colour_space

    Compatibility wrapper for PdfDocument::read_colour_space.

    pdf_read_destination

    Reads and normalizes a PDF destination object.

    This is the standalone form of PdfDocument::read_destination.

    pdf_read_document_from_bytes

    fn pdf_read_document_from_bytes(data : Bytes) -> PdfDocument raise
    PdfError

    Read a PDF document from owned PDF bytes.

    pdf_read_document_from_bytes_with_passwords

    fn pdf_read_document_from_bytes_with_passwords(data : Bytes, user_password? : BytesView?, owner_password? : BytesView?) -> PdfDecryptionResult? raise
    PdfError

    Read and decrypt a PDF document from owned PDF bytes.

    pdf_read_document_from_view

    fn pdf_read_document_from_view(data : BytesView) -> PdfDocument raise
    PdfError

    Read a PDF document from a borrowed byte view.

    This is the high-level non-password reader. It first tries the strict classic xref reader and probes the page tree; for selected structural errors it falls back to reconstruction by scanning indirect objects.

    pdf_read_document_from_view_with_passwords

    fn pdf_read_document_from_view_with_passwords(data : BytesView, user_password? : BytesView?, owner_password? : BytesView?) -> PdfDecryptionResult? raise
    PdfError

    Read and decrypt a PDF document using optional passwords.

    This is the high-level password-aware reader. It uses the same reconstruction fallback policy as pdf_read_document_from_view before attempting decryption. Unencrypted documents return a copied document inside Some(...).

    pdf_read_document_revision_from_bytes

    fn pdf_read_document_revision_from_bytes(data : Bytes, revision : Int) -> PdfDocument raise
    PdfError

    Read one document revision from owned PDF bytes.

    pdf_read_document_revision_from_bytes_with_passwords

    fn pdf_read_document_revision_from_bytes_with_passwords(data : Bytes, revision : Int, user_password? : BytesView?, owner_password? : BytesView?) -> PdfDecryptionResult? raise
    PdfError

    Read and decrypt one PDF revision from owned bytes.

    pdf_read_document_revision_from_view

    fn pdf_read_document_revision_from_view(data : BytesView, revision : Int) -> PdfDocument raise
    PdfError

    Read one document revision from a borrowed byte view.

    Revision selection uses strict classic-xref parsing and does not use the reconstruction fallback used by pdf_read_document_from_view.

    pdf_read_document_revision_from_view_with_passwords

    fn pdf_read_document_revision_from_view_with_passwords(data : BytesView, revision : Int, user_password? : BytesView?, owner_password? : BytesView?) -> PdfDecryptionResult? raise
    PdfError

    Read and decrypt one PDF revision using optional passwords.

    Revision 1 is the newest revision. The returned value is None when the document is encrypted and neither supplied password can decrypt it; otherwise it contains the decrypted document and permission information.

    pdf_read_font

    Compatibility wrapper for PdfDocument::read_font.

    pdf_read_name_tree

    Compatibility wrapper for PdfDocument::read_name_tree.

    pdf_read_number_tree

    Compatibility wrapper that returns number-tree keys as decimal ASCII bytes.

    This mirrors APIs that represent both name and number tree keys as @core.PdfBytes; each integer key is encoded with Int::to_string.

    pdf_read_ocg

    Compatibility wrapper for PdfDocument::read_optional_content_groups.

    pdf_read_page_labels

    Compatibility wrapper for PdfDocument::read_page_labels.

    pdf_read_png

    fn pdf_read_png(data : Bytes) -> PdfPNG raise
    PdfError

    Read a PNG from owned bytes, de-interlacing an Adam7 image into a sequential IDAT stream. Palette images carry their PLTE; real palette transparency (a tRNS entry below 255) is refused rather than dropped.

    pdf_read_png_view

    fn pdf_read_png_view(data : BytesView) -> PdfPNG raise
    PdfError

    Read a PNG from a byte view, de-interlacing an Adam7 image into a sequential IDAT stream. Palette images carry their PLTE; real palette transparency (a tRNS entry below 255) is refused rather than dropped.

    pdf_read_primitive_document_from_bytes

    fn pdf_read_primitive_document_from_bytes(data : Bytes) -> PdfDocument raise
    PdfError

    Parse a primitive document from owned PDF bytes.

    pdf_read_primitive_document_from_view

    fn pdf_read_primitive_document_from_view(data : BytesView) -> PdfDocument raise
    PdfError

    Parse indirect objects by scanning the byte stream without xref tables.

    This primitive reader is useful for fixtures and damaged files. It reads the header, then scans indirect object syntax and stream bodies in sequence; it does not interpret trailer/xref metadata or decrypt the document.

    pdf_recompress_pdf

    fn pdf_recompress_pdf(document : PdfDocument) -> PdfDocument raise
    PdfError

    pdf_-prefixed compatibility alias for cpdfsqueeze's recompress_pdf.

    pdf_rectify_boxes

    Compatibility wrapper for PdfDocument::rectify_boxes.

    pdf_redact

    fn pdf_redact(document : PdfDocument, path : ArrayView[(Double, Double)], page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::redact_path.

    pdf_redact_pages

    fn pdf_redact_pages(document : PdfDocument, page_numbers : ArrayView[Int], process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::redact_pages.

    pdf_redact_pages_cpdf_order

    fn pdf_redact_pages_cpdf_order(process_struct_tree : Bool, document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's redact argument order.

    pdf_remove_added_text

    fn pdf_remove_added_text(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_added_text.

    pdf_remove_added_text_ops

    Remove content marked as /CPDFSTAMP, matching cpdf's add-text cleanup.

    Nested /CPDFSTAMP ... EMC sections are skipped as a unit. If a stamp block is unterminated, all following operators are dropped, matching the OCaml recursive removal behavior.

    pdf_remove_all_metadata

    fn pdf_remove_all_metadata(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_all_metadata.

    pdf_remove_all_text

    fn pdf_remove_all_text(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_all_text.

    pdf_remove_all_text_cpdf_order

    fn pdf_remove_all_text_cpdf_order(page_numbers : ArrayView[Int], document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfremovetext's page-list-first order.

    pdf_remove_all_text_ops

    Remove text-showing operators while preserving text positioning/state ops.

    pdf_remove_annotations

    fn pdf_remove_annotations(page_numbers : ArrayView[Int], document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_annotations.

    pdf_remove_art_pdf

    fn pdf_remove_art_pdf(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_art.

    pdf_remove_attached_files

    fn pdf_remove_attached_files(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_attached_files.

    pdf_remove_bleed_pdf

    fn pdf_remove_bleed_pdf(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_bleed.

    pdf_remove_bookmarks

    fn pdf_remove_bookmarks(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_bookmarks.

    pdf_remove_clipping

    fn pdf_remove_clipping(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_clipping.

    pdf_remove_clipping_ops

    Remove clipping-path setup sequences from parsed content operators.

    This ports cpdftweak.ml's remove_clipping_ops: only the exact W n sequence is rewritten, becoming just n.

    pdf_remove_cropping_pdf

    fn pdf_remove_cropping_pdf(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_cropping.

    pdf_remove_dict_entry

    fn pdf_remove_dict_entry(document : PdfDocument, key :
    PdfName
    , search? :
    PdfObject
    ?) -> Unit

    Compatibility wrapper for PdfDocument::remove_dict_entry_everywhere.

    pdf_remove_dict_entry_string

    fn pdf_remove_dict_entry_string(document : PdfDocument, key : String, search? :
    PdfObject
    ?) -> Unit

    Compatibility wrapper matching cpdfutil's string-key remove_dict_entry.

    pdf_remove_duplicate_fonts

    fn pdf_remove_duplicate_fonts(document : PdfDocument) -> Unit

    Removes duplicate embedded font streams from a document.

    This is the standalone form of PdfDocument::remove_duplicate_fonts.

    pdf_remove_fonts

    fn pdf_remove_fonts(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_embedded_fonts.

    pdf_remove_javascript

    fn pdf_remove_javascript(document : PdfDocument) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_javascript.

    pdf_remove_metadata

    fn pdf_remove_metadata(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_metadata.

    pdf_remove_obj

    fn pdf_remove_obj(document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Compatibility wrapper matching cpdftweak's remove_obj name.

    pdf_remove_object_by_spec

    fn pdf_remove_object_by_spec(document : PdfDocument, spec : String) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_object_by_spec.

    pdf_remove_ocg

    Compatibility wrapper for PdfDocument::remove_optional_content_groups.

    pdf_remove_page_box

    fn pdf_remove_page_box(document : PdfDocument, page_numbers : ArrayView[Int], box_name :
    PdfName
    ) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_page_box.

    pdf_remove_page_labels

    fn pdf_remove_page_labels(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_page_labels.

    pdf_remove_struct_tree

    fn pdf_remove_struct_tree(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_struct_tree.

    pdf_remove_trim_pdf

    fn pdf_remove_trim_pdf(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_trim.

    pdf_remove_unsafe_characters

    fn pdf_remove_unsafe_characters(text : String) -> String raise
    PdfError

    Source-spelled compatibility alias for cpdfattach's filename sanitizer.

    pdf_removetext

    fn pdf_removetext(page_numbers : ArrayView[Int], document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfremovetext's source-spelled removetext.

    pdf_renumber_documents

    fn pdf_renumber_documents(documents : ArrayView[PdfDocument]) -> Array[PdfDocument] raise
    PdfError

    Return copies of documents renumbered into one non-overlapping sequence.

    The first document starts at object number 1; each following document starts after the previous document's object count. This is primarily used before merging documents that may have colliding object numbers.

    pdf_renumber_pages

    Compatibility wrapper for PdfDocument::renumber_pages.

    pdf_renumber_parent_trees

    fn pdf_renumber_parent_trees(documents : ArrayView[PdfDocument]) -> Unit raise
    PdfError

    Renumber structure parent-tree keys across documents before merging.

    The documents are mutated in place. Parent-tree keys are reassigned to a single increasing sequence, and structure parent references inside each document are updated to match the rebuilt number trees.

    pdf_replace_dict_entry

    Compatibility wrapper for PdfDocument::replace_dict_entry_everywhere.

    pdf_replace_dict_entry_string

    fn pdf_replace_dict_entry_string(document : PdfDocument, key : String, value :
    PdfObject
    , search? :
    PdfObject
    ?) -> Unit

    Compatibility wrapper matching cpdfutil's string-key replace_dict_entry.

    pdf_replace_obj

    fn pdf_replace_obj(document : PdfDocument, spec : String, value :
    PdfObject
    ) -> Unit raise
    PdfError

    Compatibility wrapper matching cpdftweak's replace_obj name.

    pdf_replace_object_by_spec

    fn pdf_replace_object_by_spec(document : PdfDocument, spec : String, value :
    PdfObject
    ) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::replace_object_by_spec.

    pdf_replace_pairs

    fn pdf_replace_pairs(bookmarks : ArrayView[
    PdfBookmark
    ], document : PdfDocument, end_page : Int, filename : String, bates : Int, bates_pad : Int?, page_number : Int) -> Array[(String, () -> String)] raise
    PdfError

    Source-spelled compatibility wrapper matching cpdfaddtext's replace_pairs.

    The OCaml API receives precomputed page-reference lookup state and the page record; this wrapper derives the same page-local values from document.

    pdf_replace_stream_by_spec

    fn pdf_replace_stream_by_spec(document : PdfDocument, spec : String, data : BytesView) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::replace_stream_by_spec.

    pdf_reveal_hidden_text

    fn pdf_reveal_hidden_text(document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::reveal_hidden_text.

    pdf_reveal_hidden_text_cpdf_order

    fn pdf_reveal_hidden_text_cpdf_order(page_numbers : ArrayView[Int], document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftweak's reveal_hidden_text argument order.

    pdf_reveal_hidden_text_ops

    Remove text rendering-mode operators so hidden text is rendered normally.

    pdf_reverse_table_of_encoding

    fn pdf_reverse_table_of_encoding(encoding : PdfEncoding) -> Array[(
    PdfName
    , Int)]

    Compatibility wrapper for PdfEncoding::reverse_table.

    pdf_revisions_from_bytes

    fn pdf_revisions_from_bytes(data : Bytes) -> Int raise
    PdfError

    Count document revisions from owned PDF bytes.

    pdf_revisions_from_view

    fn pdf_revisions_from_view(data : BytesView) -> Int raise
    PdfError

    Count document revisions by following xref /Prev links.

    Revision 1 is the newest revision referenced by startxref; larger numbers walk backward through older revisions. Linearized hint-table revisions are excluded from the returned count.

    pdf_rotate_contents

    fn pdf_rotate_contents(document : PdfDocument, rotation : Double, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::rotate_contents.

    pdf_rotate_contents_cpdf_order

    fn pdf_rotate_contents_cpdf_order(rotation : Double, document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper preserving cpdfpage's rotate_contents argument order without changing the existing document-first pdf_rotate_contents.

    pdf_rotate_pages

    fn pdf_rotate_pages(document : PdfDocument, rotation : Int, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::rotate_pages.

    pdf_rotate_pages_by

    fn pdf_rotate_pages_by(document : PdfDocument, rotation : Int, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::rotate_pages_by.

    pdf_rotate_pdf

    fn pdf_rotate_pdf(rotation : Int, document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's rotate_pdf argument order.

    pdf_rotate_pdf_by

    fn pdf_rotate_pdf_by(rotation : Int, document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's rotate_pdf_by argument order.

    pdf_scale_contents

    fn pdf_scale_contents(document : PdfDocument, page_numbers : ArrayView[Int], position :
    PdfPosition
    , scale : Double, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::scale_contents.

    pdf_scale_contents_cpdf_order

    fn pdf_scale_contents_cpdf_order(position :
    PdfPosition
    , scale : Double, document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's scale_contents argument order.

    pdf_scale_pages

    fn pdf_scale_pages(document : PdfDocument, page_numbers : ArrayView[Int], scales : ArrayView[(Double, Double)], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::scale_pages.

    pdf_scale_pdf

    fn pdf_scale_pdf(scales : ArrayView[(Double, Double)], document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's scale_pdf value argument order.

    pdf_scale_to_fit_pages

    fn pdf_scale_to_fit_pages(document : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], position? :
    PdfPosition
    , input_scale? : Double, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::scale_to_fit_pages.

    pdf_scale_to_fit_pdf

    fn[T] pdf_scale_to_fit_pdf(position :
    PdfPosition
    , input_scale : Double, sizes : ArrayView[(Double, Double)], _op : T, document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's scale_to_fit_pdf argument order.

    pdf_scale_to_fit_rotate

    fn pdf_scale_to_fit_rotate(sizes : ArrayView[(Double, Double)], rotation : Int, document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's scale_to_fit_rotate order.

    pdf_scale_to_fit_rotate_pages

    fn pdf_scale_to_fit_rotate_pages(document : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], rotation : Int, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::scale_to_fit_rotate_pages.

    pdf_secure_random_bytes

    fn pdf_secure_random_bytes(length : Int) -> Bytes raise
    PdfError

    Return cryptographically secure random bytes on the native target.

    The native stub uses the platform RNG (BCryptGenRandom on Windows and /dev/urandom on Unix-like systems). Negative lengths raise @core.PdfError::InvalidReadLength; RNG failures raise @core.PdfError::RandomBytesUnavailable.

    pdf_set_annotations_json

    fn pdf_set_annotations_json(json : Json, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_annotations_json.

    pdf_set_annotations_json_cpdf_order

    fn pdf_set_annotations_json_cpdf_order(document : PdfDocument, json : Json) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfannot's set_annotations_json order.

    pdf_set_box

    fn pdf_set_box(document : PdfDocument, page_numbers : ArrayView[Int], box_name :
    PdfName
    , min_x : Double, max_x : Double, min_y : Double, max_y : Double) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_page_box.

    pdf_set_box_string

    fn pdf_set_box_string(box_name : String, min_x : Double, max_x : Double, min_y : Double, max_y : Double, document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's setBox scalar argument order.

    pdf_set_debug_image_processing

    fn pdf_set_debug_image_processing(enabled : Bool) -> Unit

    Set cpdfimage's debug_image_processing flag through the source-spelled compatibility surface.

    pdf_set_language

    fn pdf_set_language(document : PdfDocument, language : BytesView) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_language.

    pdf_set_language_string

    fn pdf_set_language_string(document : PdfDocument, language : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper setting /Lang from cpdf-style text.

    pdf_set_mediabox

    fn pdf_set_mediabox(boxes : ArrayView[(Double, Double, Double, Double)], document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's set_mediabox argument order.

    pdf_set_mediaboxes

    fn pdf_set_mediaboxes(document : PdfDocument, page_numbers : ArrayView[Int], boxes : ArrayView[(Double, Double, Double, Double)]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_mediaboxes.

    pdf_set_metadata_date

    fn pdf_set_metadata_date(document : PdfDocument, date : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_metadata_date.

    pdf_set_metadata_from_bytes

    fn pdf_set_metadata_from_bytes(keep_version : Bool, data : BytesView, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_metadata_from_bytes.

    pdf_set_non_full_screen_page_mode

    fn pdf_set_non_full_screen_page_mode(document : PdfDocument, mode : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_non_full_screen_page_mode.

    pdf_set_open_action

    fn pdf_set_open_action(document : PdfDocument, fit : Bool, page_number : Int, destination? :
    PdfObject
    ?) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_open_action.

    pdf_set_open_action_cpdf_order

    fn pdf_set_open_action_cpdf_order(document : PdfDocument, fit : Bool, page_number : Int, destination? : String?) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfmetadata's string destination API.

    pdf_set_open_action_string_destination

    fn pdf_set_open_action_string_destination(document : PdfDocument, fit : Bool, page_number : Int, destination? : String?) -> PdfDocument raise
    PdfError

    Compatibility wrapper for cpdfmetadata's string destination syntax.

    pdf_set_page_layout

    fn pdf_set_page_layout(document : PdfDocument, layout : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_page_layout.

    pdf_set_page_mode

    fn pdf_set_page_mode(document : PdfDocument, mode : String) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_page_mode.

    pdf_set_pdf_info

    fn pdf_set_pdf_info(key :
    PdfName
    , value :
    PdfObject
    , version : Int, document : PdfDocument, keep_version? : Bool, xmp_also? : Bool, xmp_just_set? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::set_info_entry.

    pdf_set_pdf_info_cpdf_order

    fn pdf_set_pdf_info_cpdf_order(entry : (String,
    PdfObject
    , Int), document : PdfDocument, xmp_also? : Bool, xmp_just_set? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfmetadata's string-key tuple form.

    pdf_set_pdf_info_string

    fn pdf_set_pdf_info_string(entry : (String,
    PdfObject
    , Int), document : PdfDocument, xmp_also? : Bool, xmp_just_set? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfmetadata's string-key tuple form.

    pdf_set_progress

    fn pdf_set_progress(enabled : Bool) -> Unit

    Enable or disable progress output capture.

    pdf_set_version

    fn pdf_set_version(minor : Int, document : PdfDocument) -> Unit

    Compatibility wrapper for cpdf's minor-version setter.

    pdf_set_viewer_preference

    Compatibility wrapper for PdfDocument::set_viewer_preference.

    pdf_set_viewer_preference_cpdf_order

    fn pdf_set_viewer_preference_cpdf_order(entry : (String,
    PdfObject
    , Int), document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfmetadata's string-key tuple form.

    pdf_set_viewer_preference_string

    fn pdf_set_viewer_preference_string(entry : (String,
    PdfObject
    , Int), document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfmetadata's string-key tuple form.

    pdf_setcap

    fn pdf_setcap(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setcap over explicit draw state.

    pdf_setdash

    fn pdf_setdash(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setdash over explicit draw state.

    pdf_setfill

    fn pdf_setfill(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setfill over explicit draw state.

    pdf_setfontname

    fn pdf_setfontname(control : PdfDrawControl, font_name : String) -> Unit

    Source-spelled cpdfdrawcontrol setfontname over explicit draw state.

    pdf_setfontsize

    fn pdf_setfontsize(control : PdfDrawControl, font_size : Double) -> Unit

    Source-spelled cpdfdrawcontrol setfontsize over explicit draw state.

    pdf_setjoin

    fn pdf_setjoin(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setjoin over explicit draw state.

    pdf_setmatrix

    fn pdf_setmatrix(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmatrix over explicit draw state.

    pdf_setmiter

    fn pdf_setmiter(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmiter over explicit draw state.

    pdf_setmrotate

    fn pdf_setmrotate(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmrotate over explicit draw state.

    pdf_setmscale

    fn pdf_setmscale(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmscale over explicit draw state.

    pdf_setmshearx

    fn pdf_setmshearx(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmshearx over explicit draw state.

    pdf_setmsheary

    fn pdf_setmsheary(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmsheary over explicit draw state.

    pdf_setmtranslate

    fn pdf_setmtranslate(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setmtranslate over explicit draw state.

    pdf_setrolemap

    fn pdf_setrolemap(control : PdfDrawControl, role_map : String) -> Unit

    Source-spelled cpdfdrawcontrol setrolemap over explicit draw state.

    pdf_setstroke

    fn pdf_setstroke(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setstroke over explicit draw state.

    pdf_setthickness

    fn pdf_setthickness(control : PdfDrawControl, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol setthickness over explicit draw state.

    pdf_shift_boxes

    fn pdf_shift_boxes(document : PdfDocument, page_numbers : ArrayView[Int], offsets : ArrayView[(Double, Double)]) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::shift_boxes.

    pdf_shift_boxes_cpdf_order

    fn pdf_shift_boxes_cpdf_order(offsets : ArrayView[(Double, Double)], document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's shift_boxes argument order.

    pdf_shift_pages

    fn pdf_shift_pages(document : PdfDocument, page_numbers : ArrayView[Int], offsets : ArrayView[(Double, Double)], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::shift_pages.

    pdf_shift_pdf

    fn pdf_shift_pdf(offsets : ArrayView[(Double, Double)], document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's shift_pdf value argument order.

    pdf_shortest_unused_prefix

    fn pdf_shortest_unused_prefix(document : PdfDocument) -> String

    Compatibility wrapper for PdfDocument::shortest_unused_prefix.

    pdf_show_annotation_bounding_boxes

    fn pdf_show_annotation_bounding_boxes(document : PdfDocument, page_numbers : ArrayView[Int], light? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::show_annotation_bounding_boxes.

    pdf_show_bounding_boxes

    fn pdf_show_bounding_boxes(document : PdfDocument, page_numbers : ArrayView[Int], shape? :
    PdfRectangle
    ?, light? : Bool, fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::show_bounding_boxes.

    pdf_show_bounding_boxes_cpdf_order

    fn pdf_show_bounding_boxes_cpdf_order(fast : Bool, shape :
    PdfRectangle
    ?, light : Bool, document : PdfDocument, page_numbers : ArrayView[Int]) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfredact's show_bounding_boxes order.

    pdf_show_boxes

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

    Compatibility wrapper for PdfDocument::show_page_boxes.

    pdf_show_composition

    fn pdf_show_composition(file_size : Int, json : Bool, document : PdfDocument) -> Bytes raise
    PdfError

    Return the bytes cpdf's show_composition would print.

    pdf_show_composition_json_blob

    fn pdf_show_composition_json_blob(file_size : Int, document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::composition_json_blob.

    pdf_simplify_utf16be

    fn pdf_simplify_utf16be(bytes : BytesView) -> Bytes raise
    PdfError

    Re-encode a UTF-16BE PDF string using PDFDocEncoding when possible.

    Non-Unicode input is returned as an owned copy. Malformed UTF-16BE raises @core.PdfError::InvalidUTF16BE.

    pdf_size_attached_files

    fn pdf_size_attached_files(document : PdfDocument) -> Int raise
    PdfError

    Compatibility wrapper for PdfDocument::size_attached_files.

    pdf_squeeze

    fn pdf_squeeze(document : PdfDocument, page_data? : Bool) -> PdfDocument raise
    PdfError

    pdf_-prefixed compatibility alias for cpdfsqueeze's squeeze.

    pdf_stamp

    fn pdf_stamp(document : PdfDocument, page_numbers : ArrayView[Int], overlay : PdfDocument, relative_to_box? :
    PdfName
    , position? :
    PdfPosition
    , topline? : Bool, midline? : Bool, fast? : Bool, scale_to_fit? : Bool, is_over? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::stamp_pages.

    pdf_stamp_as_xobject

    Compatibility wrapper for PdfDocument::stamp_as_xobject.

    pdf_stamp_as_xobject_string

    fn pdf_stamp_as_xobject_string(document : PdfDocument, range : ArrayView[Int], overlay : PdfDocument) -> (PdfDocument, String) raise
    PdfError

    Compatibility wrapper matching cpdfxobject's string resource-name result.

    pdf_stamp_cpdf_order

    fn pdf_stamp_cpdf_order(process_struct_tree : Bool, relative_to_box : String, position :
    PdfPosition
    , topline : Bool, midline : Bool, fast : Bool, scale_to_fit : Bool, is_over : Bool, page_numbers : ArrayView[Int], overlay : PdfDocument, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's stamp argument order.

    pdf_standard14_afm_data

    Returns the Adobe Font Metrics data for a standard font.

    pdf_standard14_baseline_adjustment

    fn pdf_standard14_baseline_adjustment(font : PdfStandardFont) -> Int

    Returns the baseline adjustment used by CamlPDF for this standard font.

    pdf_standard14_flags_of_standard_font

    fn pdf_standard14_flags_of_standard_font(font : PdfStandardFont) -> Int

    Returns the PDF font descriptor flags for this standard font.

    pdf_standard14_stemv_of_standard_font

    fn pdf_standard14_stemv_of_standard_font(font : PdfStandardFont) -> Int

    Returns the /StemV value used when writing this standard font.

    pdf_standard14_text_width

    fn pdf_standard14_text_width(font : PdfStandardFont, encoding : PdfEncoding, text : BytesView, kern? : Bool) -> Int

    Computes the width of byte-encoded text in standard-font glyph units.

    When kern is true, AFM kerning pairs are included between adjacent character codes.

    pdf_standard14_textwidth

    fn pdf_standard14_textwidth(kern : Bool, encoding : PdfEncoding, font : PdfStandardFont, text : BytesView) -> Int

    CamlPDF-shaped wrapper for standard-14 text width calculation.

    pdf_standard_font_of_name

    fn pdf_standard_font_of_name(name : String) -> PdfStandardFont?

    Recognize a standard 14 font from an ASCII PDF font name.

    name is expected to include the leading slash, for example "/Helvetica". Common Microsoft aliases such as /Arial and /TimesNewRoman are accepted for CamlPDF compatibility.

    pdf_standard_font_of_pdf_name

    fn pdf_standard_font_of_pdf_name(name :
    PdfName
    ) -> PdfStandardFont?

    Recognize a standard 14 font from a byte-oriented PDF name.

    This is the allocation-light variant used while parsing font dictionaries. It accepts the canonical PDF names and the same common aliases as pdf_standard_font_of_name.

    pdf_standard_font_substitute_filenames

    fn pdf_standard_font_substitute_filenames(font : PdfStandardFont) -> Array[String]

    Return cpdf's substitute font file candidates for a Standard 14 font.

    This is the pure table from cpdfembed.ml's load_substitute; callers that need bytes can resolve these filenames relative to their own filesystem boundary.

    pdf_standard_font_substitute_font_name

    fn pdf_standard_font_substitute_font_name(font : PdfStandardFont) -> String

    Return cpdf's substitute font name for a Standard 14 font.

    pdf_startxobj

    fn pdf_startxobj(control : PdfDrawControl, name : String) -> Unit

    Source-spelled cpdfdrawcontrol startxobj over explicit draw state.

    pdf_stretch

    fn pdf_stretch(sizes : ArrayView[(Double, Double)], document : PdfDocument, page_numbers : ArrayView[Int], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdfpage's stretch value argument order.

    pdf_stretch_pages

    fn pdf_stretch_pages(document : PdfDocument, page_numbers : ArrayView[Int], sizes : ArrayView[(Double, Double)], fast? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::stretch_pages.

    pdf_strftime

    Format text using cpdf's strftime subset.

    When time is omitted, the native local time is used.

    pdf_string_of_bookmark

    Format a bookmark as a diagnostic byte string.

    The output includes level, title bytes, destination object, and open state; it is intended for debugging rather than PDF serialization.

    pdf_string_of_calculator

    fn pdf_string_of_calculator(ops : ArrayView[PdfCalculatorOp]) -> String

    Format calculator operations as a brace-delimited diagnostic program.

    pdf_string_of_colour_space

    fn pdf_string_of_colour_space(space : PdfColourSpace) -> String

    Compatibility wrapper for PdfColourSpace::debug_name.

    pdf_string_of_content_op

    Compatibility wrapper for pdf_content_bytes_of_op.

    The name follows CamlPDF, where strings were byte sequences; this function returns @core.PdfBytes.

    pdf_string_of_content_ops

    Compatibility wrapper for pdf_content_bytes_of_ops.

    The name follows CamlPDF, where strings were byte sequences; this function returns @core.PdfBytes.

    pdf_string_of_drawop

    fn pdf_string_of_drawop(op : PdfDrawOp) -> String

    Compatibility wrapper for PdfDrawOp::debug_name.

    pdf_string_of_drawops

    fn pdf_string_of_drawops(ops : ArrayView[PdfDrawOp]) -> String

    Return cpdf's space-prefixed diagnostic string for a list of draw ops.

    pdf_string_of_font

    fn pdf_string_of_font(font : PdfFont) -> String

    Compatibility wrapper for PdfFont::debug_name.

    pdf_string_of_function

    fn pdf_string_of_function(function : PdfFunction) -> String

    Compatibility wrapper for PdfFunction::debug_string.

    pdf_string_of_pagespec

    fn pdf_string_of_pagespec(document : PdfDocument, pages : ArrayView[Int]) -> String raise
    PdfError

    Source-spelled wrapper for PdfDocument::string_of_pagespec.

    pdf_string_of_pdf

    Compatibility alias for pdf_write_object.

    pdf_string_of_pdf_including_data

    fn pdf_string_of_pdf_including_data(object :
    PdfObject
    ) -> Bytes raise
    PdfError

    Compatibility alias for pdf_write_object.

    Stream data is included because PdfStreamObject serialization writes the stream dictionary, stream marker, bytes, and endstream marker.

    pdf_string_of_position

    fn pdf_string_of_position(position :
    PdfPosition
    ) -> String

    Return the cpdf debug spelling for a position keyword.

    pdf_string_of_standard_font

    fn pdf_string_of_standard_font(font : PdfStandardFont) -> String

    Compatibility wrapper for PdfStandardFont::name.

    pdf_string_of_type

    fn pdf_string_of_type(elements : ArrayView[PdfTypeElement]) -> Bytes

    Render a cpdftype element stream using CamlPDF's leading-newline format.

    pdf_string_of_type_element

    fn pdf_string_of_type_element(element : PdfTypeElement) -> Bytes

    Render one cpdftype element using the CamlPDF debug spelling.

    pdf_string_of_xmltree

    Source-spelled compatibility alias for cpdfmetadata's string_of_xmltree.

    pdf_stroke

    fn pdf_stroke(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's stroke.

    pdf_strokefill

    fn pdf_strokefill(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's strokefill.

    pdf_strokefillevenodd

    fn pdf_strokefillevenodd(control : PdfDrawControl) -> Unit raise
    PdfError

    Source-spelled compatibility wrapper for cpdfdrawcontrol's strokefillevenodd.

    pdf_subformat_of_string

    fn pdf_subformat_of_string(text : String) -> PdfUASubformat raise
    PdfError

    Source-spelled compatibility alias for cpdfua's subformat_of_string.

    pdf_table_of_encoding

    fn pdf_table_of_encoding(encoding : PdfEncoding) -> Array[(Int,
    PdfName
    )]

    Compatibility wrapper for PdfEncoding::table.

    pdf_target_of_pagenumber

    Compatibility wrapper for PdfDocument::target_of_page_number.

    pdf_test_extract_text

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

    Compatibility wrapper for PdfDocument::test_extract_text.

    pdf_text_extractor_of_font

    Compatibility wrapper for PdfDocument::text_extractor_of_font.

    pdf_text_extractor_of_font_real

    fn pdf_text_extractor_of_font_real(font : PdfFont) -> PdfTextExtractor

    Compatibility wrapper for PdfFont::text_extractor.

    pdf_texttopdf_of_utf8_with_newlines

    fn pdf_texttopdf_of_utf8_with_newlines(fontpack : PdfFontPack, font_size : Double, text : BytesView) -> Array[PdfTypeElement] raise
    PdfError

    Convert UTF-8 text into cpdftype instructions using a font pack.

    Newlines become PdfTypeNewLine, carriage returns are ignored, and representable Unicode codepoints are emitted as one-byte PDF charcodes.

    pdf_texttopdf_tag_paragraphs

    fn pdf_texttopdf_tag_paragraphs(elements : ArrayView[PdfTypeElement]) -> Array[PdfTypeElement]

    Add paragraph tags around a cpdftype stream.

    This mirrors cpdftexttopdf.ml: a blank line closes the current paragraph, preserves both line breaks, and starts a new paragraph with tag number zero.

    pdf_texttopdf_typeset

    fn pdf_texttopdf_typeset(fontpack : PdfFontPack, font_size : Double, paper :
    PaperSize
    , text : BytesView, process_struct_tree? : Bool, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Typeset UTF-8 text into a standalone PDF document using an existing font pack.

    When process_struct_tree is set, paragraph tags are added and a /StructTreeRoot with page-level parent-tree entries is installed.

    pdf_texttopdf_typeset_cpdf_order

    fn pdf_texttopdf_typeset_cpdf_order(process_struct_tree : Bool, paper :
    PaperSize
    , fontpack : PdfFontPack, font_size : Double, text : BytesView, subformat? : PdfUASubformat?, title? : String?) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftexttopdf's typeset required argument order.

    pdf_thin_lines

    fn pdf_thin_lines(document : PdfDocument, page_numbers : ArrayView[Int], width : Double) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::thin_lines.

    pdf_thin_lines_ops

    Rewrite line widths to honor the cpdf thin-lines threshold.

    Positive width is a minimum width. Negative width uses its absolute value as a maximum width, matching cpdftweak.ml.

    pdf_thinlines

    fn pdf_thinlines(page_numbers : ArrayView[Int], width : Double, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftweak's thinlines name and order.

    pdf_toc_add_bookmark

    fn pdf_toc_add_bookmark(document : PdfDocument, title : BytesView) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::toc_add_bookmark.

    pdf_toc_bookmark_text

    fn pdf_toc_bookmark_text(title : BytesView) -> Bytes raise
    PdfError

    Convert a TOC title to the PDFDocString stored in the generated bookmark.

    Literal \n byte pairs are converted to line-feed bytes before PDFDocString encoding, matching cpdftoc's real_newline helper.

    pdf_toc_insert_pages

    Compatibility wrapper for PdfDocument::toc_insert_pages.

    pdf_toc_make_dots

    fn pdf_toc_make_dots(space : Double, fontpack : PdfFontPack, font_size : Double) -> Array[PdfTypeElement] raise
    PdfError

    Build cpdftoc's dot-leader run for an available horizontal space.

    pdf_toc_of_pdfdocencoding

    fn pdf_toc_of_pdfdocencoding(fontpack : PdfFontPack, font_size : Double, text : BytesView) -> Array[PdfTypeElement] raise
    PdfError

    Convert PDFDocEncoding/PDFDocString bytes into the font/text runs used by cpdftoc.

    pdf_toc_of_utf8

    fn pdf_toc_of_utf8(fontpack : PdfFontPack, font_size : Double, text : BytesView) -> Array[PdfTypeElement] raise
    PdfError

    Convert UTF-8 text into the font/text runs used by cpdftoc.

    Unrepresentable codepoints are skipped, matching cpdf's option_map(Cpdfembed.get_char fontpack) behavior. Unlike the text-to-PDF paragraph helper, this function treats input as a single run and does not interpret newline characters.

    pdf_toc_shift_page_labels

    Shift existing page-label ranges after prepended TOC pages.

    cpdftoc writes a no-label range for the inserted TOC pages, then preserves existing labels by moving their start pages forward by the TOC page count.

    pdf_toc_shorten_text

    fn pdf_toc_shorten_text(fontpack : PdfFontPack, font_size : Double, max_width : Double, runs : ArrayView[PdfTypeElement]) -> Array[PdfTypeElement] raise
    PdfError

    Shorten the final text run to fit max_width, appending ... if shortened.

    This intentionally mirrors cpdf's narrow helper: only the final Font/Text pair is trimmed and measured.

    pdf_toc_split_title

    fn pdf_toc_split_title(title : BytesView) -> Array[Bytes]

    Split a TOC title on the literal byte sequence \n.

    This mirrors cpdftoc.ml's split_toc_title, which splits before UTF-8 conversion and preserves leading, trailing, and adjacent empty title lines.

    pdf_toc_title_real_newlines

    fn pdf_toc_title_real_newlines(title : BytesView) -> Bytes

    Replace literal \n byte pairs in a TOC title with real line-feed bytes.

    pdf_toc_type_elements

    fn pdf_toc_type_elements(document : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, dotleader : Bool, process_struct_tree : Bool, labels : ArrayView[
    PdfPageLabel
    ], bookmarks : ArrayView[
    PdfBookmark
    ], page_width : Double, margin : Double) -> Array[PdfTypeElement] raise
    PdfError

    Compatibility wrapper for PdfDocument::toc_type_elements.

    pdf_toc_typeset_pages

    fn pdf_toc_typeset_pages(document : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, dotleader : Bool, process_struct_tree : Bool, labels : ArrayView[
    PdfPageLabel
    ], bookmarks : ArrayView[
    PdfBookmark
    ]) -> PdfTypeTypesetResult raise
    PdfError

    Compatibility wrapper for PdfDocument::toc_typeset_pages.

    pdf_toc_used_codepoints

    Compatibility wrapper for PdfDocument::toc_used_codepoints.

    pdf_toc_width_of_runs

    fn pdf_toc_width_of_runs(runs : ArrayView[PdfTypeElement]) -> Double raise
    PdfError

    Return the total width of cpdftoc's alternating Font/Text run list.

    pdf_toc_with_fontpack

    fn pdf_toc_with_fontpack(document : PdfDocument, fontpack : PdfFontPack, font_size : Double, title : BytesView, bookmark? : Bool, dotleader? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::toc_with_fontpack.

    pdf_toc_with_source

    fn pdf_toc_with_source(document : PdfDocument, source : PdfTocFontSource, font_size : Double, title : BytesView, bookmark? : Bool, dotleader? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::toc_with_source.

    pdf_transform_annotations

    Compatibility wrapper for PdfDocument::transform_annotations.

    pdf_transform_bookmark

    Compatibility wrapper for PdfDocument::transform_bookmark.

    pdf_transform_destination

    Applies a page transform matrix to destination coordinates.

    This is the standalone form of PdfDocument::transform_destination.

    pdf_trim_marks

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

    Compatibility wrapper for PdfDocument::trim_marks.

    pdf_trim_structure_tree

    fn pdf_trim_structure_tree(document : PdfDocument, page_numbers : ArrayView[Int]) -> Unit raise
    PdfError

    Compatibility wrapper for PdfDocument::trim_structure_tree.

    pdf_truetype_cmap_glyph

    fn pdf_truetype_cmap_glyph(data : BytesView, codepoint : Int) -> Int?

    Look up one Unicode codepoint in the merged TrueType cmap mappings.

    pdf_truetype_cmap_glyphs

    Return merged TrueType cmap Unicode-to-glyph mappings.

    This ports the cmap-table reader used by Cpdftruetype.parse before the later width/subset writer stages. Source-supported cmap formats 0, 4, and 6 are decoded; later encoding subtables replace earlier mappings for the same codepoint, matching the source Hashtbl.add/find behavior. A font with no cmap table follows the source fallback of mapping byte codes 0..255 to the same glyph index.

    pdf_truetype_cmaps

    fn pdf_truetype_cmaps(data : BytesView) -> Array[(Int, Int)]

    Return the TrueType cmap platform and encoding IDs.

    This ports Cpdftruetype.cmaps, which is used as a PDF/UA verification helper. The source function catches parse failures and returns the records collected before the failure; this function likewise ignores malformed or incomplete parts of the font after complete cmap records have been read.

    pdf_truetype_descriptor_metrics

    Return the descriptor metrics read from the TrueType OS/2 and post tables by Cpdftruetype.parse.

    The source parser requires OS/2 for normal embedding, scales its signed metrics to PDF units, reads the high word of the post italic-angle fixed value when available, and derives both symbolic and non-symbolic font flags.

    pdf_truetype_expand_composite_glyphs

    fn pdf_truetype_expand_composite_glyphs(data : BytesView, glyph_indices : ArrayView[Int]) -> Array[Int] raise
    PdfError

    Expand glyph indices to include nested TrueType composite glyph components.

    This ports the expand_composites helper used by Cpdftruetype before writing subset loca and glyf tables. Returned indices are sorted and deduplicated, matching the source setify/sort behavior.

    pdf_truetype_glyph_byte_ranges

    Return glyf byte ranges for glyphs after composite expansion.

    Ranges are relative to the start of the glyf table, matching the source byterange calculation immediately before subset glyf table writing.

    pdf_truetype_higher_tounicode

    fn pdf_truetype_higher_tounicode(subset_codepoints : ArrayView[Int]) -> Array[(Int, Bytes)]? raise
    PdfError

    Build the ToUnicode entries used by cpdf's implicit higher TrueType subsets.

    Source character codes start at 33 and each maps positionally to the matching Unicode scalar from subset_codepoints. The stored bytes are UTF-16BE without the PDF Unicode string BOM, matching Cpdftruetype.seconds_tounicodes.

    pdf_truetype_loca_offsets

    fn pdf_truetype_loca_offsets(data : BytesView) -> Array[Int] raise
    PdfError

    Return decoded loca offsets from a TrueType font.

    This ports read_loca_table: short offsets are doubled, long offsets are read directly, and unknown indexToLocFormat values raise the source error.

    pdf_truetype_metrics

    Return the TrueType metrics needed by Cpdftruetype.parse.

    This ports the table reads used before font subsetting proper: /head provides units, PDF-unit bounding box, and indexToLocFormat; /maxp provides numGlyphs; optional /hhea provides numOfLongHorMetrics; and /hmtx provides the raw advance widths used for cpdf's width calculations.

    pdf_truetype_parse

    Parse and subset a TrueType font using cpdf's simple-font split strategy.

    The returned array contains the main non-symbolic subset first, followed by any higher implicit-font-file subsets. This wires together the ported Cpdftruetype.parse prerequisites: subset partitioning, width calculation, subset font-file generation, descriptor metrics, and higher-subset ToUnicode mappings.

    pdf_truetype_partition_subsets

    fn pdf_truetype_partition_subsets(encoding : PdfEncoding, subset_codepoints : ArrayView[Int]) ->
    PdfTrueTypeSubsetPartition

    Split a Unicode subset into the main simple-font subset and higher implicit-font-file subsets.

    This mirrors Cpdftruetype.find_main: codepoints whose numeric value is a defined one-byte code in the selected encoding stay in the main subset, and all remaining codepoints are split into chunks of 224 for higher subsets.

    pdf_truetype_subset_cmap_table

    fn pdf_truetype_subset_cmap_table(data : BytesView, subset_codepoints : ArrayView[Int]) ->
    PdfTrueTypeSubsetTable
    raise
    PdfError

    Write the format-6 cmap table used by cpdf for implicit-font-file subsets.

    Character codes start at 33; each Unicode value in subset_codepoints contributes its original glyph index, or 0 if the original cmap has no mapping. The returned bytes are padded, while length is the unpadded table length for directory metadata.

    pdf_truetype_subset_font

    fn pdf_truetype_subset_font(data : BytesView, subset_codepoints : ArrayView[Int], rewrite_cmap? : Bool) -> Bytes raise
    PdfError

    Build a cpdf-style subset TrueType font file.

    This ports the subset_font table-directory assembly around the already ported loca, glyf, and format-6 cmap writers. Non-required TrueType tables are removed, source checksums are preserved, table offsets are adjusted by removed header/data spans and rewritten table sizes, and table payloads are written in source table-order. Set rewrite_cmap=true for the source ImplicitInFontFile higher-subset path; the default preserves the original cmap table like the main subset path.

    pdf_truetype_subset_glyf_table

    fn pdf_truetype_subset_glyf_table(data : BytesView, subset_codepoints : ArrayView[Int]) ->
    PdfTrueTypeSubsetTable
    raise
    PdfError

    Write a padded subset glyf table for the given Unicode subset.

    The returned length is the unpadded table length for the TrueType table directory; bytes contains the padded table payload actually written to the font file.

    pdf_truetype_subset_glyph_indices

    fn pdf_truetype_subset_glyph_indices(data : BytesView, subset_codepoints : ArrayView[Int]) -> Array[Int] raise
    PdfError

    Return the glyph indices used by a TrueType Unicode subset.

    This mirrors the glyph collection inside the source write_loca_table and write_glyf_table helpers: .notdef glyph 0 is always included, missing Unicode mappings are ignored, and composite glyph components are expanded recursively before the sorted/deduplicated glyph-index set is returned.

    pdf_truetype_subset_loca_table

    fn pdf_truetype_subset_loca_table(data : BytesView, subset_codepoints : ArrayView[Int]) -> Bytes raise
    PdfError

    Write a padded subset loca table for the given Unicode subset.

    The original glyph indices are preserved: entries for skipped glyph IDs are written as zero-length ranges pointing at the next selected glyph offset, matching Cpdftruetype.write_loca_table.

    pdf_truetype_table

    fn pdf_truetype_table(data : BytesView, tag : String) ->
    PdfTrueTypeTableRecord
    ?

    Return one table-directory record by tag.

    pdf_truetype_tables

    Return complete table-directory records from a TrueType font.

    This is the first structural pass in Cpdftruetype.parse: it reads numTables, then each (tag, checksum, offset, length) table record.

    pdf_truetype_widths

    fn pdf_truetype_widths(data : BytesView, encoding : PdfEncoding, firstchar : Int, lastchar : Int, subset_codepoints : ArrayView[Int]) -> Array[Int] raise
    PdfError

    Calculate the /Widths array for the main TrueType subset.

    Width lookup follows Cpdftruetype.calculate_widths: PDF character codes are first mapped through the selected simple encoding to Unicode, characters outside the subset get width 0, glyph indexes outside /hmtx use the last advance width, and missing cmap mappings fall back to the first raw hmtx width as in the source.

    pdf_truetype_widths_higher

    fn pdf_truetype_widths_higher(data : BytesView, firstchar : Int, lastchar : Int, subset_codepoints : ArrayView[Int]) -> Array[Int] raise
    PdfError

    Calculate the /Widths array for an implicit higher TrueType subset.

    Character codes are positional starting at firstchar, so each position is looked up directly in subset_codepoints, matching Cpdftruetype.calculate_width_higher.

    pdf_twoup

    fn pdf_twoup(document : PdfDocument, fast? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::twoup.

    pdf_twoup_stack

    fn pdf_twoup_stack(document : PdfDocument, fast? : Bool, process_struct_tree? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::twoup_stack.

    pdf_type_add_artifacts

    Source-spelled compatibility alias for cpdftype's add_artifacts.

    pdf_type_font_widths

    fn pdf_type_font_widths(font : PdfFont, font_size : Double) -> Array[Double] raise
    PdfError

    Build a cpdftype-style width table for one-byte PDF text charcodes.

    Widths are returned in user units for the requested font size. This ports the standalone cpdftype.ml font_widths behavior for standard fonts and simple fonts with explicit metrics. CID fonts and simple fonts without metrics raise @core.PdfError::FontWidthExpected.

    pdf_type_layout

    fn pdf_type_layout(lmargin : Double, rmargin : Double, paper :
    PaperSize
    , elements : ArrayView[PdfTypeElement]) -> Array[PdfTypeElement] raise
    PdfError

    Lay out cpdftype elements into wrapped lines for the requested paper width.

    The rmargin parameter is accepted for parity with CamlPDF but intentionally ignored: the source computes the maximum x position as page_width - lmargin.

    pdf_type_paginate

    fn pdf_type_paginate(tmargin : Double, bmargin : Double, paper :
    PaperSize
    , elements : ArrayView[PdfTypeElement]) -> Array[PdfTypeElement]

    Insert page breaks into a laid-out cpdftype stream.

    Active structure tags are closed before an inserted PdfTypeNewPage and reopened immediately after it, matching CamlPDF's pagination helper.

    pdf_type_split_text

    fn pdf_type_split_text(space_left : Double, widths : ArrayView[Double], text : BytesView) -> (Bytes, Bool, Bytes) raise
    PdfError

    Split one byte-encoded text run so at least one word is emitted.

    This follows CamlPDF's cpdftype.ml behavior: words are split only on ASCII space, the first word is kept even when it exceeds space_left, and a space separator is retained after every non-final word in the emitted prefix.

    pdf_type_to_string

    fn pdf_type_to_string(elements : ArrayView[PdfTypeElement]) -> Bytes

    Source-spelled compatibility alias for cpdftype's to_string.

    pdf_type_typeset

    fn pdf_type_typeset(document : PdfDocument, process_struct_tree : Bool, lmargin : Double, rmargin : Double, tmargin : Double, bmargin : Double, paper :
    PaperSize
    , elements : ArrayView[PdfTypeElement]) -> PdfTypeTypesetResult raise
    PdfError

    Compatibility wrapper for PdfDocument::pdf_type_typeset.

    pdf_type_typeset_cpdf_order

    fn pdf_type_typeset_cpdf_order(process_struct_tree : Bool, lmargin : Double, rmargin : Double, tmargin : Double, bmargin : Double, paper :
    PaperSize
    , document : PdfDocument, elements : ArrayView[PdfTypeElement]) -> PdfTypeTypesetResult raise
    PdfError

    Compatibility wrapper matching cpdftype's typeset argument order.

    pdf_type_width_of_bytes

    fn pdf_type_width_of_bytes(widths : ArrayView[Double], text : BytesView) -> Double raise
    PdfError

    Sum a cpdftype width table for byte-encoded text.

    Each input byte is used directly as a charcode index. A width table shorter than the largest charcode raises @core.PdfError::FontWidthExpected.

    pdf_type_width_of_string

    fn pdf_type_width_of_string(widths : ArrayView[Double], text : BytesView) -> Double raise
    PdfError

    Source-spelled compatibility alias for cpdftype's byte-string width helper.

    pdf_typeset_table_of_contents

    fn pdf_typeset_table_of_contents(source : PdfTocFontSource, font_size : Double, title : BytesView, bookmark : Bool, dotleader : Bool, process_struct_tree : Bool, document : PdfDocument, subformat? : PdfUASubformat?) -> PdfDocument raise
    PdfError

    Compatibility wrapper matching cpdftoc's typeset_table_of_contents name.

    pdf_ua_create_pdfua1

    fn pdf_ua_create_pdfua1(title : String, paper :
    PaperSize
    , page_count : Int) -> PdfDocument raise
    PdfError

    Create a blank PDF/UA-1 document with the given title and page size.

    pdf_ua_create_pdfua2

    fn pdf_ua_create_pdfua2(title : String, paper :
    PaperSize
    , page_count : Int) -> PdfDocument raise
    PdfError

    Create a blank PDF/UA-2 document with the given title and page size.

    pdf_ua_extract_struct_tree

    fn pdf_ua_extract_struct_tree(document : PdfDocument) -> Json raise
    PdfError

    Compatibility wrapper for PdfDocument::extract_struct_tree.

    pdf_ua_extract_struct_tree_json_blob

    fn pdf_ua_extract_struct_tree_json_blob(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::struct_tree_json_blob.

    pdf_ua_mark

    Compatibility wrapper for PdfDocument::mark_pdfua1.

    pdf_ua_mark2

    fn pdf_ua_mark2(year : Int, document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::mark_pdfua2.

    pdf_ua_print_struct_tree

    fn pdf_ua_print_struct_tree(document : PdfDocument) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::struct_tree_text.

    pdf_ua_remove_mark

    fn pdf_ua_remove_mark(document : PdfDocument) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::remove_pdfua_mark.

    pdf_ua_replace_struct_tree

    fn pdf_ua_replace_struct_tree(document : PdfDocument, json : Json) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::replace_struct_tree.

    pdf_ua_subformat_of_string

    fn pdf_ua_subformat_of_string(text : String) -> PdfUASubformat raise
    PdfError

    Parse CamlPDF's PDF/UA subformat spelling.

    pdf_ua_test_matterhorn_json

    fn pdf_ua_test_matterhorn_json(document : PdfDocument, test_name : String) -> Json raise
    PdfError

    Compatibility wrapper for PdfDocument::test_matterhorn_json.

    pdf_ua_test_matterhorn_print

    fn pdf_ua_test_matterhorn_print(document : PdfDocument, test_name : String) -> Bytes raise
    PdfError

    Compatibility wrapper for PdfDocument::test_matterhorn_text.

    pdf_unicode_data

    Return cpdf's parsed UnicodeData table, decoded and parsed on demand.

    pdf_unicode_data_source

    fn pdf_unicode_data_source() -> Bytes raise
    PdfError

    Return cpdf's compressed UnicodeData source bytes.

    pdf_unicodedata

    Source-spelled compatibility wrapper for cpdfunicodedata's unicodedata.

    pdf_unicodedata_source

    fn pdf_unicodedata_source() -> Bytes raise
    PdfError

    Source-spelled compatibility wrapper for cpdfunicodedata's unicodedata_source.

    pdf_upright

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

    Compatibility wrapper matching cpdfpage's upright argument order.

    pdf_upright_pages

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

    Compatibility wrapper for PdfDocument::upright_pages.

    pdf_usexobj

    fn pdf_usexobj(control : PdfDrawControl, name : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol usexobj over explicit draw state.

    pdf_utf16be_of_codepoints

    fn pdf_utf16be_of_codepoints(codepoints : ArrayView[Int]) -> Bytes raise
    PdfError

    Encode Unicode scalar values as a PDF UTF-16BE string with BOM.

    Invalid scalar values, including surrogate codepoints, raise @core.PdfError::InvalidUnicodeCodepoint.

    pdf_utf8_of_codepoints

    fn pdf_utf8_of_codepoints(codepoints : ArrayView[Int]) -> Bytes raise
    PdfError

    Encode Unicode scalar values as UTF-8 bytes.

    Invalid scalar values, including surrogate codepoints, raise @core.PdfError::InvalidUnicodeCodepoint.

    pdf_utf8_of_pdfdocstring

    fn pdf_utf8_of_pdfdocstring(bytes : BytesView) -> Bytes raise
    PdfError

    Convert a PDF string byte sequence to UTF-8 bytes.

    pdf_vflip_pdf

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

    Compatibility wrapper for PdfDocument::flip_pages_vertically.

    pdf_write_colour_space

    fn pdf_write_colour_space(document : PdfDocument, space : PdfColourSpace) ->
    PdfObject

    Compatibility wrapper for PdfDocument::write_colour_space.

    pdf_write_document

    fn pdf_write_document(document : PdfDocument) -> Bytes raise
    PdfError

    Serialize a complete document with a classic xref table.

    pdf_write_document_incremental_update

    fn pdf_write_document_incremental_update(original : Bytes, document : PdfDocument) -> Bytes raise
    PdfError

    Append a classic incremental update to original PDF bytes.

    Only objects marked as changed in document are written. The previous startxref position is read from original and emitted as /Prev.

    pdf_write_document_incremental_update_with_compressed_xref_stream

    fn pdf_write_document_incremental_update_with_compressed_xref_stream(original : Bytes, document : PdfDocument) -> Bytes raise
    PdfError

    Append an incremental update using a Flate-compressed xref stream.

    pdf_write_document_incremental_update_with_generated_id

    fn pdf_write_document_incremental_update_with_generated_id(original : Bytes, document : PdfDocument, path : String, mode? :
    PdfWriteMode
    ) -> Bytes raise
    PdfError

    Append an incremental update after generating a current trailer ID.

    The generated ID is based on path and current document state and is applied to a copy of the document before writing.

    pdf_write_document_incremental_update_with_mode

    fn pdf_write_document_incremental_update_with_mode(original : Bytes, document : PdfDocument, mode :
    PdfWriteMode
    ) -> Bytes raise
    PdfError

    Append an incremental update using the selected xref representation.

    pdf_write_document_incremental_update_with_xref_stream

    fn pdf_write_document_incremental_update_with_xref_stream(original : Bytes, document : PdfDocument) -> Bytes raise
    PdfError

    Append an incremental update using an uncompressed xref stream.

    pdf_write_document_options

    fn pdf_write_document_options(document : PdfDocument, encryption? :
    PdfWriteEncryption
    ?, update_from? : Bytes?, make_id? : Bool, id_path? : String, mode? :
    PdfWriteMode
    , file_id? : BytesView, aes_iv_provider? : (Int, Int, Int) -> Bytes raise
    PdfError
    ?, aesv3_random_provider? : (
    PdfAesV3RandomField
    , Int) -> Bytes raise
    PdfError
    ?) -> Bytes raise
    PdfError

    One-call writer with optional encryption, IDs, incremental update, and mode.

    The input document is copied before IDs or encryption are applied. update_from selects incremental output. make_id controls generated trailer IDs for unencrypted writes; encrypted writes always use the provided file_id or generate one through the encryption helper. AES modes require the corresponding IV and random providers.

    pdf_write_document_with_compressed_xref_stream

    fn pdf_write_document_with_compressed_xref_stream(document : PdfDocument) -> Bytes raise
    PdfError

    Serialize a complete document with a Flate-compressed xref stream.

    pdf_write_document_with_generated_id

    fn pdf_write_document_with_generated_id(document : PdfDocument, path : String, mode? :
    PdfWriteMode
    ) -> Bytes raise
    PdfError

    Serialize a complete document after generating a current trailer ID.

    The source document is copied before its ID is generated.

    pdf_write_document_with_mode

    Serialize a complete document using the selected xref representation.

    pdf_write_document_with_xref_stream

    fn pdf_write_document_with_xref_stream(document : PdfDocument) -> Bytes raise
    PdfError

    Serialize a complete document with an uncompressed xref stream.

    The output header is at least PDF 1.5, because xref streams require that version.

    pdf_write_encrypted_128bit_document

    fn pdf_write_encrypted_128bit_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt with 128-bit ARC4 revision 3 and serialize in the selected mode.

    pdf_write_encrypted_128bit_r4_document

    fn pdf_write_encrypted_128bit_r4_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt with revision-4 ARC4 crypt filters and serialize.

    encrypt_metadata=false follows the PDF revision-4 no-metadata behavior.

    pdf_write_encrypted_40bit_document

    fn pdf_write_encrypted_40bit_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt with 40-bit ARC4 and serialize in the selected write mode.

    pdf_write_encrypted_aesv2_document

    fn pdf_write_encrypted_aesv2_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt and serialize a document with AESV2 using native randomness.

    The encrypted document is written with the requested write mode. Supplying a file_id controls the trailer ID used for key derivation; IVs remain random.

    pdf_write_encrypted_aesv2_document_with_iv_provider

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

    Encrypt with AESV2 and serialize.

    iv_provider supplies IVs by object number, generation, and per-object index. This allows deterministic fixtures or secure caller-provided IVs.

    pdf_write_encrypted_aesv3_document

    fn pdf_write_encrypted_aesv3_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], iso? : Bool, encrypt_metadata? : Bool, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt and serialize a document with AESV3/AES-256 using native randomness.

    Set iso=true for the ISO/PDF 2.0 hash variant. The requested write mode is applied after encryption.

    pdf_write_encrypted_aesv3_document_with_providers

    fn pdf_write_encrypted_aesv3_document_with_providers(document : 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, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt with AESV3/AES-256 and serialize.

    random_provider supplies file keys, salts, and permissions padding; iv_provider supplies object-data IVs. iso=true selects the ISO/PDF 2.0 AESV3 hash variant.

    pdf_write_encrypted_aesv3_iso_document

    fn pdf_write_encrypted_aesv3_iso_document(document : PdfDocument, user_password : BytesView, owner_password : BytesView, denied_permissions : ArrayView[
    PdfPermission
    ], encrypt_metadata? : Bool, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt and serialize a document with the ISO AESV3/AES-256 variant.

    pdf_write_encrypted_aesv3_iso_document_with_providers

    fn pdf_write_encrypted_aesv3_iso_document_with_providers(document : 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, mode? :
    PdfWriteMode
    , file_id? : BytesView) -> Bytes raise
    PdfError

    Encrypt with the ISO AESV3/AES-256 variant and serialize.

    pdf_write_exact_real

    fn pdf_write_exact_real(value : Double) -> Bytes raise
    PdfError

    Format a PDF real number exactly: the shortest decimal that reads back as value, spelt out without an exponent (PDF 32000-1, 7.3.3), as PdfExactReal is written. An integral value is written as an integer where a PDF integer is sure to hold it (up to 2147483647 in magnitude, Annex C) and with a decimal point beyond. -0 is written as 0. Non-finite values raise @core.PdfError.

    Annex C also bounds what a reader is sure to hold as a real (about ±3.403e38, and values nearer 0 than about 1.175e-38 read as 0); values beyond are written, but are the caller's to avoid.

    pdf_write_font

    fn pdf_write_font(document : PdfDocument, font : PdfFont, objnum? : Int?) -> Int raise
    PdfError

    Compatibility wrapper for PdfDocument::write_font.

    pdf_write_hex_string

    fn pdf_write_hex_string(bytes : BytesView) -> Bytes

    Serialize bytes as a lowercase hexadecimal PDF string.

    pdf_write_indirect_object

    Serialize one indirect object including obj and endobj wrappers.

    pdf_write_literal_string

    fn pdf_write_literal_string(bytes : BytesView) -> Bytes

    Serialize bytes as a PDF literal string.

    Delimiters, backslashes, common controls, and non-printable bytes are escaped according to PDF literal-string syntax.

    pdf_write_name

    fn pdf_write_name(name :
    PdfName
    ) -> Bytes

    Serialize a PDF name object with required delimiter and hex escaping.

    The returned bytes include the leading slash.

    pdf_write_object

    Serialize a direct PDF object.

    Stream lengths are refreshed from the current stream data while writing.

    pdf_write_ocg

    Compatibility wrapper for PdfDocument::write_optional_content_groups.

    pdf_write_page_labels

    Compatibility wrapper for PdfDocument::write_page_labels.

    pdf_write_real

    fn pdf_write_real(value : Double) -> Bytes raise
    PdfError

    Format a PDF real number as bytes.

    Scientific notation is expanded to PDF-compatible decimal form where possible. Non-finite or unparsable numeric text raises @core.PdfError.

    pdf_xmltree_of_bytes

    Source-spelled compatibility alias for cpdfmetadata's xmltree_of_bytes.

    pdf_xobjbbox

    fn pdf_xobjbbox(control : PdfDrawControl, document : PdfDocument, text : String) -> Unit raise
    PdfError

    Source-spelled cpdfdrawcontrol xobjbbox over explicit draw state.

    recompress_pdf

    Compatibility wrapper for PdfDocument::recompress.

    squeeze

    fn squeeze(document : PdfDocument, page_data? : Bool) -> PdfDocument raise
    PdfError

    Compatibility wrapper for PdfDocument::squeeze.

    Source Files