Nutrient Web SDK
    Preparing search index...

    This record is used to persist information related to custom fonts on Standalone deployments. Custom fonts need to be specified during the instance load and correctly fetched. They will be used while rendering the document contents and exporting its annotations.

    Create a new Font object

    const fetcher = name =>
    fetch(`https://example.com/${name}`).then(r => {
    if (r.status === 200) {
    return r.blob();
    } else {
    throw new Error();
    }
    });

    const customFonts = ["arial.ttf", "helvetica.ttf", "tahoma.ttf"]
    .map(font => new NutrientViewer.Font({ name: font, callback: fetcher }));

    NutrientViewer.load({
    customFonts,
    regular options...
    }).then(instance => {});

    Hierarchy

    Index

    Constructors

    Properties

    callback: null | FontCallback

    Non-optional callback to fetch the custom font.

    name: null | string

    A unique identifier to name the custom font.

    Methods

    • Returns IterableIterator<
          [
              keyof { callback: null
              | FontCallback; name: null | string },
              null | string | FontCallback,
          ],
      >

    • Returns this

      Map#asImmutable

    • Returns this

      Map#asMutable

    • Returns a new instance of this Record type with all values set to their default values.

      Returns this

    • Returns a new instance of this Record type with the value for the specific key set to its default value.

      Type Parameters

      • K extends keyof { callback: null | FontCallback; name: null | string }

      Parameters

      • key: K

      Returns this

      remove

    • Parameters

      Returns this

      removeIn

    • Parameters

      • other: any

      Returns boolean

    • Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.

      If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.

      Type Parameters

      • K extends keyof { callback: null | FontCallback; name: null | string }

      Parameters

      • key: K
      • OptionalnotSetValue: any

      Returns { callback: null | FontCallback; name: null | string }[K]

    • Type Parameters

      • T

      Parameters

      • key: string
      • notSetValue: T

      Returns T

    • Parameters

      Returns any

    • Parameters

      • key: string

      Returns key is "name" | "callback"

    • Returns number

    • Parameters

      Returns boolean

    • Parameters

      Returns this

    • Parameters

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (oldVal: any, newVal: any, key: any) => any
      • ...collections: (
            | Iterable<[string, any]>
            | Partial<{ callback: null | FontCallback; name: null | string }>
        )[]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (
            oldVal: any,
            newVal: any,
            key: keyof { callback: null | FontCallback; name: null | string },
        ) => any
      • ...collections: (
            | Iterable<[string, any]>
            | Partial<{ callback: null | FontCallback; name: null | string }>
        )[]

      Returns this

    • Type Parameters

      • K extends keyof { callback: null | FontCallback; name: null | string }

      Parameters

      • key: K

      Returns this

    • Parameters

      Returns this

    • Type Parameters

      • K extends keyof { callback: null | FontCallback; name: null | string }

      Parameters

      • key: K
      • value: { callback: null | FontCallback; name: null | string }[K]

      Returns this

    • Parameters

      Returns this

    • Deeply converts this Record to equivalent native JavaScript Object.

      Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.

      Returns { callback: any; name: any }

    • Shallowly converts this Record to equivalent native JavaScript Object.

      Returns { callback: null | FontCallback; name: null | string }

    • Shallowly converts this Record to equivalent JavaScript Object.

      Returns { callback: null | FontCallback; name: null | string }

    • Returns Keyed<
          keyof { callback: null
          | FontCallback; name: null | string },
          null | string | FontCallback,
      >

    • Type Parameters

      • K extends keyof { callback: null | FontCallback; name: null | string }

      Parameters

      • key: K
      • updater: (
            value: { callback: null | FontCallback; name: null | string }[K],
        ) => { callback: null | FontCallback; name: null | string }[K]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • updater: (value: any) => any

      Returns this

    • Returns boolean

      Map#wasAltered

    • Note: Not all methods can be used on a mutable collection or within withMutations! Only set may be used mutatively.

      Parameters

      • mutator: (mutable: this) => any

      Returns this

      Map#withMutations