Sign in

    This version of the module is deprecated: Use moonbitlang/pdflite instead

    bobzhang/pdflite/annotation does not have a README file

    PdfBytes

    type PdfBytes = Bytes

    PDF byte strings and byte streams.

    This is an alias for MoonBit Bytes because PDF strings and streams are byte sequences, not Unicode text. Use String only after an explicit PDF text decoding step.

    PdfName

    A PDF name token stored as its raw bytes without the leading slash.

    Names are byte-oriented in the PDF file format. Keeping the original bytes avoids accidental UTF-16 or UTF-8 interpretation while still allowing explicit views and owned-byte access.

    PdfObject

    The core in-memory representation of a parsed PDF object.

    Strings and names are byte-oriented PDF values, not MoonBit Unicode strings. PdfIndirect(number) is an unresolved reference by object number; callers that need the referenced object should resolve it through a PdfDocument.

    PdfRectangle

    A normalized rectangle in PDF user-space coordinates.

    min_x and min_y are always the lower bounds, and max_x and max_y are always the upper bounds. Parsers normalize PDF rectangle arrays whose coordinates are written in the opposite order.

    PdfAnnotation

    pub(all) struct PdfAnnotation {
    subtype : PdfAnnotationSubtype
    contents : Bytes?
    subject : Bytes?
    rectangle :
    PdfRectangle

    border : PdfAnnotationBorder
    colour : PdfAnnotationColour?
    rest :
    PdfObject

    } derive(Eq, ToJson,
    Debug
    )

    Parsed PDF annotation dictionary.

    contents and subject are raw PDF string bytes. rectangle is required when reading from a PDF. rest preserves dictionary entries not modeled by the typed fields so they can be written back.

    PdfAnnotationBorder

    pub(all) struct PdfAnnotationBorder {
    width : Double
    vertical_radius : Double
    horizontal_radius : Double
    style : PdfAnnotationStyle
    dash_array : Array[Int]
    } derive(Eq, ToJson,
    Debug
    )

    Parsed annotation border information.

    vertical_radius and horizontal_radius come from the legacy /Border array form. style and dash_array represent /BS dictionary entries when present.

    PdfAnnotationColour

    pub(all) struct PdfAnnotationColour {
    red : Int
    green : Int
    blue : Int
    } derive(Eq, ToJson,
    Debug
    )

    RGB annotation colour from the /C entry.

    Components are stored as integer channel values after parsing PDF numbers.

    PdfAnnotationStyle

    pub(all) enum PdfAnnotationStyle {
    AnnotationNoStyle
    AnnotationSolid
    AnnotationDashed
    AnnotationBeveled
    AnnotationInset
    AnnotationUnderlineStyle
    } derive(Eq, ToJson,
    Debug
    )

    Border style used by an annotation border dictionary.

    PdfAnnotationSubtype

    pub(all) enum PdfAnnotationSubtype {
    AnnotationText
    AnnotationLink
    AnnotationFreeText
    AnnotationLine
    AnnotationSquare
    AnnotationCircle
    AnnotationPolygon
    AnnotationPolyLine
    AnnotationHighlight
    AnnotationUnderline
    AnnotationSquiggly
    AnnotationStrikeOut
    AnnotationStamp
    AnnotationCaret
    AnnotationInk
    AnnotationPopup(PdfAnnotation)
    AnnotationFileAttachment
    AnnotationSound
    AnnotationMovie
    AnnotationWidget
    AnnotationScreen
    AnnotationPrinterMark
    AnnotationTrapNet
    AnnotationWatermark
    AnnotationThreeDee
    AnnotationUnknown(
    PdfName
    )
    } derive(Eq, ToJson,
    Debug
    )

    Supported annotation subtype.

    Popup annotations embed their resolved parent annotation when available. Unknown subtype names are preserved as AnnotationUnknown.

    pdf_annotation_make

    fn pdf_annotation_make(subtype : PdfAnnotationSubtype, contents? : Bytes?, border? : PdfAnnotationBorder, rectangle? :
    PdfRectangle
    , colour? : PdfAnnotationColour?, subject? : Bytes?) -> PdfAnnotation

    Build an annotation value with CamlPDF-compatible defaults.

    Defaults are no contents, no subject, a zero rectangle, default border, no colour, and no preserved extra dictionary entries.

    pdf_annotation_make_border

    fn pdf_annotation_make_border(width : Double, vertical_radius? : Double, horizontal_radius? : Double, style? : PdfAnnotationStyle, dash_array? : ArrayView[Int]) -> PdfAnnotationBorder

    Build an annotation border, copying the supplied dash array.