/** * @cloudpdf/viewer-angular — the full viewer as an Angular component, with the CloudPDF engine as * the default: the same `` as `@embedpdf/viewer-angular`, whose documents live on * your CloudPDF. * * ```ts * import { EpdfPdfViewer } from '@cloudpdf/viewer-angular'; * * @Component({ * imports: [EpdfPdfViewer], * template: ``, * }) * ``` * * A door like the open viewer's two (docs/conventions/viewer-doors.md): it imports the cloud * door, which registers the cloud engine on ``, re-exports the wrapper's parts, * and types the component's inputs with the cloud's `ViewerConfig`. `engine` takes the cloud * engine's settings (`baseUrl`, CloudPDF SaaS when left out), `src` a document token, an id or a * grant. There is no `scope` or `identity`: the document's token carries them. */ import '@cloudpdf/viewer'; import { ChangeDetectionStrategy, Component, computed, forwardRef, input, type InputSignal, type Signal, } from '@angular/core'; import type { ElementConfig, ViewerConfig } from '@cloudpdf/viewer'; import { definedOf, EpdfPdfViewerBase, EpdfPdfViewerRef, EpdfViewerSlots, } from '@embedpdf/viewer-angular/component'; export * from '@cloudpdf/viewer'; export { EpdfButton, EpdfCommand, EpdfCommands, EpdfIcon, EpdfMenu, EpdfMenuItem, EpdfPanel, EpdfPdfViewerRef, EpdfRegion, EpdfToolbarItem, EpdfToolbarItemContext, } from '@embedpdf/viewer-angular/component'; export type { RegionName } from '@embedpdf/viewer-angular/component'; @Component({ selector: 'epdf-pdf-viewer', imports: [EpdfViewerSlots], providers: [{ provide: EpdfPdfViewerRef, useExisting: forwardRef(() => EpdfPdfViewer) }], changeDetection: ChangeDetectionStrategy.OnPush, host: { style: 'display: block' }, template: '', }) export class EpdfPdfViewer extends EpdfPdfViewerBase { /** The whole config at once; each input given wins over its key here. */ readonly config = input(); /** The cloud engine's settings (`baseUrl`, the engine's own `token`, `fetch`), or an engine of * your own. Read once. */ readonly engine: InputSignal = input(); /** * One document: `{ token }` (a document token), `{ id }` (the engine's `token` must allow it) * or `{ grant }` (a grant from the dashboard). Another one opens in its place; * `null` closes it. */ readonly src: InputSignal = input(); /** Several documents, with their names and passwords; with these, `src` is ignored. Read once. */ readonly documents: InputSignal = input(); protected readonly elementConfig: Signal = computed(() => ({ ...this.config(), ...definedOf({ engine: this.engine(), src: this.src(), documents: this.documents(), }), ...this.sharedConfig(), })); }