iink-ts - v5.0.0
    Preparing search index...

    Class ExportManagerAbstract

    Shared implementation behind the two-function export API — exportAs for content, download for files. Handles the formats that need nothing but the local model and the renderer (json, svg, png) plus the pdf print flow, and leaves the recognition-derived formats to subclasses through ExportManager.exporters.

    The canvas is typed as TInteractiveInkCanvas because every format needs symbol-level access (model.symbols, getSymbolsBounds) that InkCanvas does not expose. Wiring another variant later means widening this type, not reworking callers.

    Hierarchy (View Summary)

    Index
    • get localExporters(): Pick<TExporterMap, "json" | "png" | "svg">

      Exporters that need only the local model and the renderer

      Returns Pick<TExporterMap, "json" | "png" | "svg">

    • get model(): IIModel

      Returns IIModel

    • Parameters

      Returns Blob

    • Parameters

      Returns string

    • Release every object URL still held and cancel the pending revocations

      Returns void

    • Export the content and hand the resulting file to the browser.

      Parameters

      • format: TDownloadFormat

        Format to download; pdf opens the print flow instead of saving a file

      • options: TPDFDownloadOptions = {}

        Which symbols to export, plus the file name. The PDF settings (format/orientation/mode/scale) are ignored by every other format.

      Returns Promise<void>

      await canvas.download("svg")
      await canvas.download("markdown", { filename: "meeting-notes" })
      await canvas.download("pdf", { orientation: "landscape" })
    • Export the content in the given format.

      Type Parameters

      Parameters

      • format: F

        Format to export to; the resolved type follows from it

      • Optionaloptions: TExportOptions

        Which symbols to export

      Returns Promise<TExportResultMap[F]>

      Promise resolving with the exported content

      const symbols = await canvas.exportAs("json")
      const svg = await canvas.exportAs("svg", { scope: "selection" })
    • Rasterize the rendered symbols to PNG.

      Parameters

      Returns Promise<Blob>

      The rasterization goes through image.onload, so it is genuinely asynchronous — the returned promise settles only once the bitmap exists. Empty content short-circuits: a zero-sized image never fires load, which would leave the promise pending forever.

    • Parameters

      Returns string

    • Build the download file name. The timestamp is a truncated ISO 8601 instant so the name is locale-independent and free of / and :, which browsers mangle in file names.

      Parameters

      • extension: string
      • Optionalfilename: string

      Returns string

    • Resolve which symbols an export covers. An explicit symbols list always wins over scope.

      Parameters

      Returns TSymbol[]

    • Parameters

      • fileName: string
      • urlData: string

      Returns void

    logger: Logger
    OBJECT_URL_REVOKE_DELAY_MS: 1000

    Delay before an object URL handed to the browser is revoked. Revoking synchronously after the anchor click cancels the download in some browsers, so the URL outlives the click by a beat.

    pdfExport: PDFExportManager