`,
})
export class LinkList {
protected readonly link = inject(EpdfLink);
protected readonly items = signal([]);
protected readonly last = signal(null);
protected readonly round = Math.round;
constructor() {
void this.link.ensureLoaded(0).then(() => this.items.set(this.link.listLinks(0)));
// Every way of following a link ends up here: a click, a key, or code.
this.link.activated$
.pipe(takeUntilDestroyed())
.subscribe(({ target, activation }) =>
this.last.set(`${target.kind} → ${activation.status}`),
);
}
}
@Component({
selector: 'demo-root',
imports: [
EpdfDocumentGate,
EpdfStage,
EpdfPageTemplate,
EpdfRenderLayer,
EpdfLinkLayer,
LinkList,
],
providers: [
provideEmbedPdf(
{ engine: () => cloudEngine(), initialDocuments: [{ source: links }] },
withStage(),
withRender(),
withInteraction(),
// The actions plugin runs a link that names a viewer command, such as the footer's Next.
withActions(),
// The browser's way to open a website, once for the viewer.
withActionsUi(),
withLink(),
),
],
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrl: './list.css',
encapsulation: ViewEncapsulation.None,
template: `