import { ChangeDetectionStrategy, Component, inject, ViewEncapsulation } from '@angular/core'; import { EpdfDocument, EpdfDocumentGate, EpdfDocuments, 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 { cloudEngine } from '@cloudpdf/engine'; const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' }; @Component({ selector: 'demo-root', imports: [EpdfDocumentGate, EpdfStage, EpdfPageTemplate, EpdfRenderLayer], providers: [ provideEmbedPdf( { engine: () => cloudEngine(), initialDocuments: [{ source: welcome, name: 'welcome.pdf' }] }, withStage(), withRender(), ), ], changeDetection: ChangeDetectionStrategy.OnPush, styleUrl: './open.css', encapsulation: ViewEncapsulation.None, template: `
{{ document.id() ? 'Opening…' : 'No document is open. Open a PDF to see it here.' }}