import { ChangeDetectionStrategy, Component, 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 { EpdfCommand, standardCommands, withCommands } from '@embedpdf/angular/commands'; import { localEngine } from '@embedpdf/engine'; // [!doc-source welcome] const welcome = async (): Promise => { const response = await fetch('https://www.embedpdf.com/pdfs/welcome.pdf'); return { kind: 'bytes', id: 'welcome', bytes: new Uint8Array(await response.arrayBuffer()) }; }; // [!/doc-source] @Component({ selector: 'demo-root', imports: [EpdfDocumentGate, EpdfStage, EpdfPageTemplate, EpdfRenderLayer, EpdfCommand], providers: [ provideEmbedPdf( { engine: () => localEngine(), initialDocuments: [{ source: welcome }] }, withStage(), withRender(), withCommands({ commands: standardCommands }), ), ], changeDetection: ChangeDetectionStrategy.OnPush, styleUrl: './buttons.css', encapsulation: ViewEncapsulation.None, template: `
@for (id of commands; track id) { }

Loading…

`, }) export class App { protected readonly commands = [ 'page:previous', 'page:next', 'zoom:out', 'zoom:in', 'zoom:fit-width', 'view:rotate-clockwise', 'document:download', ]; }