/** * Fixed-layout document contracts for page-native formats such as PDF, * CBZ, image sequences, and future fixed EPUB flows. * * Coordinates are normalized to CSS pixels with a top-left origin. Platform * renderers may render into higher-resolution backing stores by using the * viewport pixel dimensions and pixel scale values. */ export type FixedDocumentFormat = 'pdf' | 'cbz' | 'image-sequence' | (string & {}); export type FixedPageRotation = 0 | 90 | 180 | 270; export type FixedPageTransform = readonly [ a: number, b: number, c: number, d: number, e: number, f: number ]; export interface FixedPageInfo { readonly index: number; /** Page width in unscaled CSS pixels. */ readonly width: number; /** Page height in unscaled CSS pixels. */ readonly height: number; readonly rotation?: FixedPageRotation; readonly label?: string; } export type FixedPageTextDirection = 'ltr' | 'rtl' | 'ttb' | 'btt'; export interface FixedPageTextRun { readonly text: string; /** * Matrix that maps run-local text coordinates into the page's CSS pixel * coordinate space. Keeping this explicit prevents browser and non-DOM * renderers from guessing text layer positions from font metrics. */ readonly transform: FixedPageTransform; readonly width?: number; readonly height?: number; readonly fontSize?: number; readonly fontFamily?: string; readonly fontWeight?: string; readonly fontStyle?: string; readonly direction?: FixedPageTextDirection; readonly hasEOL?: boolean; } export interface FixedPageTextLayer { readonly pageIndex: number; readonly width: number; readonly height: number; readonly runs: readonly FixedPageTextRun[]; readonly text?: string; } export interface FixedPageImage { readonly pageIndex: number; readonly width: number; readonly height: number; readonly src: string; readonly mimeType?: string; readonly alt?: string; } export type FixedPageRenderIntent = 'display' | 'print' | 'thumbnail'; export type FixedPageVisualColorStrategy = 'preserve' | 'force' | 'map-neutral'; export interface FixedPageVisualColorMapping { /** * preserve: use source colors. * force: replace all colors with color/foreground. * map-neutral: replace near-neutral source colors while preserving saturated colors. */ readonly strategy?: FixedPageVisualColorStrategy; readonly color?: string; readonly foreground?: string; readonly background?: string; /** Maximum RGB channel spread considered neutral, from 0 to 1. Defaults to 0.08. */ readonly neutralThreshold?: number; } export interface FixedPageImageAppearance { /** Preserve keeps raster images unchanged while text/vector layers can still be themed. */ readonly strategy?: 'preserve'; } export interface FixedPageVisualAppearance { /** Canvas/page background used before drawing page ops. */ readonly background?: string; /** Text paint mapping. */ readonly text?: FixedPageVisualColorMapping; /** Vector path and shading paint mapping. */ readonly vector?: FixedPageVisualColorMapping; /** Raster image treatment. Images are preserved by default. */ readonly image?: FixedPageImageAppearance; } export interface FixedPageViewportOptions { readonly scale?: number; readonly devicePixelRatio?: number; readonly rotation?: FixedPageRotation; } export interface FixedPageViewport { readonly pageIndex: number; readonly scale: number; readonly devicePixelRatio: number; readonly rotation: FixedPageRotation; readonly cssWidth: number; readonly cssHeight: number; readonly pixelWidth: number; readonly pixelHeight: number; readonly pixelScaleX: number; readonly pixelScaleY: number; readonly transform: FixedPageTransform; } export interface FixedPageRenderOptions extends FixedPageViewportOptions { readonly intent?: FixedPageRenderIntent; readonly textLayer?: boolean; readonly visualAppearance?: FixedPageVisualAppearance; } export interface FixedPageRenderResult { readonly pageIndex: number; readonly cssWidth: number; readonly cssHeight: number; readonly pixelWidth: number; readonly pixelHeight: number; readonly scale: number; readonly devicePixelRatio: number; } export interface FixedDocument { readonly kind: 'fixed-document'; readonly format: FixedDocumentFormat; readonly pageCount: number; getPage(pageIndex: number): Promise | FixedPageInfo; getPages?(): Promise | readonly FixedPageInfo[]; getPageImage?(pageIndex: number): Promise | FixedPageImage; getPageText?(pageIndex: number): Promise | FixedPageTextLayer; destroy?(): Promise | void; } export interface FixedPageRenderer { readonly id: string; readonly platform: string; renderPage(document: FixedDocument, target: TTarget, pageIndex: number, options?: FixedPageRenderOptions): Promise; destroy?(): Promise | void; } export declare function isFixedDocument(value: unknown): value is FixedDocument; export declare function assertFixedPageIndex(document: Pick, pageIndex: number): void; export declare function createFixedPageViewport(page: FixedPageInfo, options?: FixedPageViewportOptions): FixedPageViewport; //# sourceMappingURL=fixed-document.d.ts.map