Example
Creating an image and rendering it as Custom Overlay Item.
let img = document.createElement("img");
img.src = "https://example.com/logo.png";
const item = new NutrientViewer.CustomOverlayItem({
id: "logo-item",
node: img,
pageIndex: 0,
position: new NutrientViewer.Geometry.Point({ x: 100, y: 100 }),
onAppear() {
console.log('rendered!');
}
});
instance.setCustomOverlayItem(item);
See Also
Hierarchy
Constructors
Parameters
args{ … }
Properties
Whether the node should not be zoomed (scaled) with the page.
Custom zoom handling makes sense when you want to display rasterized images for example,
and you need to manually re-render them (maybe when using <canvas> images or want to display
images at different resolutions).
To track zoom changes and manually update overlay items you can subscribe to the
viewState.zoom.change event.
By default items will zoom with the page using a CSS based scale transformation.
Default Value
falseA unique identifier to describe the custom overlay item. New IDs should be generated by the user and should be unique.
onAppear
Optional callback to invoke when the custom item is created and appears in the viewport.
onDisappear
Optional callback to invoke when the custom item is removed.
The page index on which the custom item is placed. It's important to notice that a custom item can only ever be on one page.
Position of this custom item in the page. The coordinates are in the PDF page space with the origin being on the top left.
Immutable Record API
31
"[iterator]"(): IterableIterator<
[
keyof { … },
| string
| number
| boolean
| Node
| NutrientViewer.Geometry.Point
| ((...args: unknown[]) => void)
| ((...args: unknown[]) => void)
| null
| undefined,
],
>Returns
IterableIterator<
[
keyof { … },
| string
| number
| boolean
| Node
| NutrientViewer.Geometry.Point
| ((...args: unknown[]) => void)
| ((...args: unknown[]) => void)
| null
| undefined
]
>
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
delete<K extends keyof { … }>(key: K): this
Returns a new instance of this Record type with the value for the specific key set to its default value.
Parameters
otherunknownReturns
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.
Returns
number
Parameters
keyPathIterable<unknown>...collectionsunknown[]Returns
this
Parameters
keyPathIterable<unknown>...collectionsunknown[]Returns
this
remove<K extends keyof { … }>(key: K): 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
{ … }
Shallowly converts this Record to equivalent native JavaScript Object.
Returns
{ … }
Shallowly converts this Record to equivalent JavaScript Object.
Returns
{ … }
toSeq(): Keyed<
keyof { … },
| string
| number
| boolean
| Node
| NutrientViewer.Geometry.Point
| ((...args: unknown[]) => void)
| ((...args: unknown[]) => void)
| null
| undefined,
>Returns
Keyed<
keyof { … },
| string
| number
| boolean
| Node
| NutrientViewer.Geometry.Point
| ((...args: unknown[]) => void)
| ((...args: unknown[]) => void)
| null
| undefined
>
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 the information for a Custom Overlay Item.
Custom Overlay Items are user defined DOM
Nodes that are rendered in a page at a given position.