Class: Font

PSPDFKit.Font

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.

Constructor

new PSPDFKit.Font(args)

An object used to load a new font.

Parameters:
Name Type Description
args object

An object used to load a new font.

Example

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 PSPDFKit.Font({ name: font, callback: fetcher }));

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

Extends

  • Immutable.Record

Members




Members

callback: FontCallback

Non-optional callback to fetch the custom font.

Type:

name: string

A unique identifier to name the custom font.

Type:
  • string