VMPrint API Reference - v1.0.0
    Preparing search index...

    A lightweight PDF rendering context backed by jsPDF.

    • jsPDF does not stream output — the complete PDF is generated at end(). pipe() stores the VmprintOutputStream reference; end() writes the full ArrayBuffer to it in one shot.

    • jsPDF always opens the first page automatically. The renderer calls addPage() for every page including the first, so the first call is a no-op here.

    • Standard-font handling mirrors the PDFKit context exactly: when registerFont() receives a standardFontPostScriptName, the font id is mapped to the corresponding jsPDF built-in name and no binary data is registered. Custom fonts are base64-encoded and registered via addFileToVFS / addFont.

    • Transforms (translate, rotate) and graphics state (save, restore, opacity) are delegated to jsPDF's setCurrentTransformationMatrix / saveGraphicsState / restoreGraphicsState / setGState. jsPDF sets up an initial page CTM that flips the y-axis so that all subsequent cm operators (and these helpers) operate in the same y-down user space that the PDFKit context exposes.

    • Path building (moveTo / lineTo / bezierCurveTo / rect / roundedRect) uses jsPDF's public path API. fill() / stroke() / fillAndStroke() close the path and paint it. The rounded-rect approximation uses cubic Bézier curves at k ≈ 0.5523 (the standard quarter-circle approximation).

    Implements

    Index

    Constructors

    Methods

    • Parameters

      • cp1x: number
      • cp1y: number
      • cp2x: number
      • cp2y: number
      • x: number
      • y: number

      Returns this

    • Parameters

      • length: number
      • Optionaloptions: { space: number }

      Returns this

    • Parameters

      • Optionalrule: "nonzero" | "evenodd"

      Returns this

    • Parameters

      • OptionalfillColor: string
      • OptionalstrokeColor: string

      Returns this

    • Parameters

      • family: string
      • Optionalsize: number

      Returns this

    • Returns { height: number; width: number }

    • Parameters

      • source: string | Uint8Array<ArrayBufferLike>
      • x: number
      • y: number
      • Optionaloptions: ContextImageOptions

      Returns this

    • Parameters

      • x: number
      • y: number

      Returns this

    • Parameters

      • x: number
      • y: number

      Returns this

    • Parameters

      • x: number
      • y: number
      • w: number
      • h: number

      Returns this

    • Parameters

      • angle: number
      • OptionaloriginX: number
      • OptionaloriginY: number

      Returns this

    • Parameters

      • x: number
      • y: number
      • w: number
      • h: number
      • r: number

      Returns this

    • Emit pre-shaped glyphs directly to the PDF stream using their fontkit glyph IDs. This bypasses PDFKit's text()/encode() path, which would re-run shaping and lose the contextual glyph substitutions (init/medi/fina/liga) computed at layout time. Required for correct rendering of Arabic and other RTL/CTL scripts.

      Parameters

      • fontId: string
      • fontSize: number
      • color: string
      • x: number
      • y: number
      • ascent: number
      • glyphs: ContextShapedGlyph[]

      Returns this