import { ChangeDetectionStrategy, Component, computed, inject, 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 { EpdfInteraction, withInteraction } from '@embedpdf/angular/interaction'; import { EpdfAnnotation, EpdfAnnotationLayer, withAnnotation } from '@embedpdf/angular/annotation'; import { cloudEngine } from '@cloudpdf/engine'; const sketch: OpenInput = { kind: 'grant', grant: 'shr_IyOgSdO4AmJqV4BoMv5V0nYU' }; @Component({ selector: 'demo-after-drawing', changeDetection: ChangeDetectionStrategy.OnPush, template: `
{{ interaction.activeToolId() === 'square' ? 'Drawing' : 'Selecting' }}
`, }) export class AfterDrawing { protected readonly annotation = inject(EpdfAnnotation); protected readonly interaction = inject(EpdfInteraction); protected readonly afterCreate = computed(() => this.annotation.settings().afterCreate); constructor() { // The rectangle tool is active on load. this.interaction.activateTool('square'); } } @Component({ selector: 'demo-root', imports: [ EpdfDocumentGate, EpdfStage, EpdfPageTemplate, EpdfRenderLayer, EpdfAnnotationLayer, AfterDrawing, ], providers: [ provideEmbedPdf( { engine: () => cloudEngine(), initialDocuments: [{ source: sketch }] }, withStage(), withRender(), withInteraction(), withAnnotation(), ), ], changeDetection: ChangeDetectionStrategy.OnPush, styleUrl: './after-create.css', encapsulation: ViewEncapsulation.None, template: `

Loading…

`, }) export class App {}