import { ChangeDetectionStrategy, Component, signal, ViewEncapsulation } from '@angular/core'; import { EpdfDocumentGate, provideEmbedPdf } from '@embedpdf/angular/runtime'; import type { OpenInput } from '@embedpdf/angular/runtime'; import { EpdfPageTemplate, EpdfStage, withStage } from '@embedpdf/angular/stage'; import { EpdfRenderLayer, withRender } from '@embedpdf/angular/render'; import { withInteraction } from '@embedpdf/angular/interaction'; import { EpdfAnnotationLayer, withAnnotation } from '@embedpdf/angular/annotation'; import { cloudEngine } from '@cloudpdf/engine'; const report: OpenInput = { kind: 'grant', grant: 'shr__TWhIGdJtaKlcnVgJdg--bcm' }; type Painter = 'picture' | 'layer'; @Component({ selector: 'demo-root', imports: [EpdfDocumentGate, EpdfStage, EpdfPageTemplate, EpdfRenderLayer, EpdfAnnotationLayer], providers: [ provideEmbedPdf( { engine: () => cloudEngine(), initialDocuments: [{ source: report }] }, withStage(), withRender(), withInteraction(), withAnnotation(), ), ], changeDetection: ChangeDetectionStrategy.OnPush, styleUrl: './annotations.css', encapsulation: ViewEncapsulation.None, template: ` In the page picture Drawn by the annotation layer @if (painter() === 'picture') { Part of the picture: it can’t be picked up. } @else { Left out of the picture: click it, then drag it. } @if (painter() === 'picture') { } @else { } Loading… `, }) export class App { protected readonly painter = signal('picture'); }
@if (painter() === 'picture') { Part of the picture: it can’t be picked up. } @else { Left out of the picture: click it, then drag it. }
Loading…