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 NutrientViewer.Font({ name: font, callback: fetcher }));
NutrientViewer.load({
customFonts,
document: 'https://example.com/document.pdf'
}).then(instance => {});
Hierarchy
Constructors
Parameters
args{ callback?: FontCallback; name: string }
Properties
Immutable Record API
31
- "[iterator]"(): IterableIterator<
[
keyof { callback: FontCallback
| null; name: string | null },
string | FontCallback | null,
],
>Returns
IterableIterator<
[
keyof { callback: FontCallback
| null; name: string | null },
string | FontCallback | null
]
>
Returns
thisSee Also
Map#asImmutable
Returns
thisSee Also
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
Kextends keyof { callback: FontCallback | null; name: string | null }Parameters
keyKReturns
this
Parameters
otherunknownReturns
boolean
- get<K extends keyof { callback: FontCallback | null; name: string | null }>(
key: K,
notSetValue?: unknown,
): { callback: FontCallback | null; name: string | null }[K]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
Kextends keyof { callback: FontCallback | null; name: string | null }Parameters
keyKnotSetValueunknownOptionalReturns
{ callback: FontCallback | null; name: string | null }[K]
Parameters
keystringReturns
key is "name" | "callback"
Returns
number
- merge(
...collections: (
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[],
): thisParameters
...collections(
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[]Returns
this
- mergeDeep(
...collections: (
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[],
): thisParameters
...collections(
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[]Returns
this
Parameters
keyPathIterable<unknown>...collectionsunknown[]Returns
this
- mergeDeepWith(
merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown,
...collections: (
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[],
): thisParameters
merger(oldVal: unknown, newVal: unknown, key: unknown) => unknown...collections(
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[]Returns
this
Parameters
keyPathIterable<unknown>...collectionsunknown[]Returns
this
- mergeWith(
merger: (
oldVal: unknown,
newVal: unknown,
key: keyof { callback: FontCallback | null; name: string | null },
) => unknown,
...collections: (
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[],
): thisParameters
merger(
oldVal: unknown,
newVal: unknown,
key: keyof { callback: FontCallback | null; name: string | null }
) => unknown...collections(
| Iterable<[string, unknown], any, any>
| Partial<{ callback: FontCallback | null; name: string | null }>
)[]Returns
this
Type Parameters
Kextends keyof { callback: FontCallback | null; name: string | null }Parameters
keyKReturns
this
- set<K extends keyof { callback: FontCallback | null; name: string | null }>(
key: K,
value: { callback: FontCallback | null; name: string | null }[K],
): thisType Parameters
Kextends keyof { callback: FontCallback | null; name: string | null }Parameters
keyKvalue{ callback: FontCallback | null; name: string | null }[K]Returns
this
Parameters
keyPathIterable<unknown>valueunknownReturns
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: unknown; name: string | null }
Shallowly converts this Record to equivalent native JavaScript Object.
Returns
{ callback: FontCallback | null; name: string | null }
Shallowly converts this Record to equivalent JavaScript Object.
Returns
{ callback: FontCallback | null; name: string | null }
- toSeq(): Keyed<
keyof { callback: FontCallback
| null; name: string | null },
string | FontCallback | null,
>Returns
Keyed<
keyof { callback: FontCallback
| null; name: string | null },
string | FontCallback | null
>
- update<K extends keyof { callback: FontCallback | null; name: string | null }>(
key: K,
updater: (
value: { callback: FontCallback | null; name: string | null }[K],
) => { callback: FontCallback | null; name: string | null }[K],
): thisType Parameters
Kextends keyof { callback: FontCallback | null; name: string | null }Parameters
keyKupdater(
value: { callback: FontCallback | null; name: string | null }[K]
) => { callback: FontCallback | null; name: string | null }[K]Returns
this
Parameters
keyPathIterable<unknown>updater(value: unknown) => unknownReturns
this
Returns
booleanSee Also
Map#wasAltered
Note: Not all methods can be used on a mutable collection or within
withMutations! Onlysetmay be used mutatively.Parameters
mutator(mutable: this) => unknownReturns
thisSee Also
Map#withMutations
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.