import { ChangeDetectionStrategy, Component, inject, signal, ViewEncapsulation, } from '@angular/core'; import { EpdfDocumentGate, EpdfDocuments, isPluginError, 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' }; // Read and select, but no downloading. const scope = ['doc.open', 'doc.render', 'doc.text.select']; /** What the last download did: the bytes, or why it was refused. */ type Result = | { kind: 'downloaded'; byteLength: number } | { kind: 'refused'; code: string; permission: string | null }; @Component({ selector: 'demo-download-anyway', changeDetection: ChangeDetectionStrategy.OnPush, template: `
`, }) export class DownloadAnyway { private readonly documents = inject(EpdfDocuments); protected readonly result = signalOpening…