@lifeart/gxt
Version:
<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">
73 lines (71 loc) • 2.64 kB
TypeScript
import { Component } from '../../component';
import { PdfBrowserDOMApi } from './pdf-api';
import { PdfDocument } from './elements';
export declare const PDF_CONTEXT: unique symbol;
export interface PdfViewerSignature {
Args: {
/** Width of the viewer */
width?: string;
/** Height of the viewer */
height?: string;
/** Show toolbar in viewer */
showToolbar?: boolean;
/** Called when PDF is rendered */
onRender?: (blob: Blob) => void;
/** Called on error */
onError?: (error: Error) => void;
/** Auto-update on changes (default: true) */
autoUpdate?: boolean;
/** CSS class for the container */
className?: string;
};
Blocks: {
default: [];
};
[key: string]: unknown;
}
export type PdfViewerProps = PdfViewerSignature['Args'];
export interface PdfContext {
api: PdfBrowserDOMApi;
document: PdfDocument | null;
render: () => Promise<Blob | null>;
download: (filename?: string) => Promise<void>;
getBlob: () => Promise<Blob | null>;
getDataUrl: () => Promise<string | null>;
}
/**
* Create PDF context state
*/
export declare function createPdfContextState(api: PdfBrowserDOMApi): PdfContext;
/**
* PdfViewer Component
*/
export declare class PdfViewer extends Component<PdfViewerSignature> {
private containerNode;
private iframeNode;
private api;
private pdfContext;
private root;
private renderTimeout;
constructor();
private scheduleRender;
private cleanup;
_template(): Component<any> | import('../../control-flow/if').IfCondition | import('../../control-flow/list').AsyncListComponent<any> | import('../../control-flow/list').SyncListComponent<any>;
}
/**
* PdfDownloadLink - A component for downloading PDFs
*/
export interface PdfDownloadLinkProps {
document: PdfDocument;
fileName?: string;
className?: string;
style?: Record<string, string>;
}
export declare function PdfDownloadLink(this: Component<PdfDownloadLinkProps>): Component<any> | import('../../control-flow/if').IfCondition | import('../../control-flow/list').AsyncListComponent<any> | import('../../control-flow/list').SyncListComponent<any>;
/**
* BlobProvider - Provides PDF blob data via render prop pattern
*/
export interface BlobProviderProps {
document: PdfDocument;
}
export declare function BlobProvider(this: Component<BlobProviderProps>): Component<any> | import('../../control-flow/if').IfCondition | import('../../control-flow/list').AsyncListComponent<any> | import('../../control-flow/list').SyncListComponent<any>;