@grapecity-software/gcdocs.pdfviewer
Version:
GcDocs PDF Viewer
39 lines (38 loc) • 1.45 kB
TypeScript
import GcPdfViewer from "..";
export declare class ExternalPdfManager {
viewer: GcPdfViewer;
static readonly EMPTY_FILE_ID = "blank";
_loadedDocs: {
[id: string]: any;
};
_loadedDocsPromises: {
[id: string]: any;
};
constructor(viewer: GcPdfViewer);
getDocument(fileId1: string, array?: Uint8Array): Promise<any>;
cleanup(): void;
renderThumbImage(fileId: string, pageIndex: number, rotateAngle?: number): Promise<{
img: HTMLImageElement;
sizeRatio: number;
}>;
/**
* Creates and prepares a 2D rendering context for generating page thumbnails.
* The method ensures correct scaling for HiDPI displays and applies
* a white background to avoid transparency artifacts.
*/
private _getPageDrawContext;
/**
* Renders a PDF page into a thumbnail image element.
* Handles rotation, HiDPI scaling, and ensures a white background.
*
* @param page - PDF.js page object
* @param rotateAngle - Optional additional rotation angle in degrees
* @returns A promise that resolves to an object containing:
* - img: The generated thumbnail as an HTMLImageElement
* - sizeRatio: The page aspect ratio (height / width)
*/
renderPageThumbnail(page: any, rotateAngle?: number): Promise<{
img: HTMLImageElement;
sizeRatio: number;
}>;
}