AperturaViewerComponent
class AperturaViewerComponent implements AfterViewInit, OnChanges, OnDestroy
A document viewer component for Angular.
The API and lifecycle are complete, but the package is built with the shared
tsup toolchain rather than ng-packagr, so it is suitable for JIT mode and for
development. Publishing it for Angular production builds requires moving to
ng-packagr and the partial-Ivy format, which is a separate step for when this
wrapper reaches release.
file
ByteSourceInput | undefined
What to open: a `File`, a `Blob`, a byte buffer, or a URL.
options
ViewerOptions
Viewer options: zoom, fit mode, a custom format registry.
stateChange
EventEmitter<ViewerState>
ngAfterViewInit
() => void
A callback method that is invoked immediately after
Angular has completed initialization of a component's view.
It is invoked only once when the view is instantiated.
ngOnChanges
(changes: SimpleChanges) => void
A callback method that is invoked immediately after the
default change detector has checked data-bound properties
if at least one has changed, and before the view and content
children are checked.
ngOnDestroy
() => void
A callback method that performs custom clean-up, invoked immediately
before a directive, pipe, or service instance is destroyed.
viewer
Viewer | undefined
Direct access to the viewer, for cases the inputs do not cover.
Viewerfrom @apertura/viewer
class Viewer
A framework-independent document viewer.
The single place that knows the full path from bytes to format to document to
DOM. The React, Vue and Angular wrappers are thin adapters over this class, so
their behaviour is identical by construction rather than by convention.
view
DocumentView | undefined
The live view, for reaching format-specific APIs such as page navigation.
subscribe
(listener: (state: ViewerState) => void) => () => void
Subscribes to state changes. Returns an unsubscribe function.
open
(input: ByteSourceInput, options?: ViewerOptions) => Promise<void>
Opens a file and mounts its view.
Calling it again before the previous call settles is correct: the older
result is discarded. That is the normal case when a user picks files in
quick succession.
refresh
() => void
Re-renders the current view.
close
() => void
Closes the document and clears the container.
destroy
() => void
Releases every resource. The instance must not be used afterwards.