fix: defer pdf deps and profile flag detection
This commit is contained in:
7
src/types/napi-rs-canvas.d.ts
vendored
Normal file
7
src/types/napi-rs-canvas.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare module "@napi-rs/canvas" {
|
||||
export type Canvas = {
|
||||
toBuffer(type?: string): Buffer;
|
||||
};
|
||||
|
||||
export function createCanvas(width: number, height: number): Canvas;
|
||||
}
|
||||
34
src/types/pdfjs-dist-legacy.d.ts
vendored
Normal file
34
src/types/pdfjs-dist-legacy.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
declare module "pdfjs-dist/legacy/build/pdf.mjs" {
|
||||
export type TextItem = {
|
||||
str: string;
|
||||
};
|
||||
|
||||
export type TextMarkedContent = {
|
||||
type?: string;
|
||||
};
|
||||
|
||||
export type TextContent = {
|
||||
items: Array<TextItem | TextMarkedContent>;
|
||||
};
|
||||
|
||||
export type Viewport = {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
export type PDFPageProxy = {
|
||||
getTextContent(): Promise<TextContent>;
|
||||
getViewport(params: { scale: number }): Viewport;
|
||||
render(params: { canvas: unknown; viewport: Viewport }): { promise: Promise<void> };
|
||||
};
|
||||
|
||||
export type PDFDocumentProxy = {
|
||||
numPages: number;
|
||||
getPage(pageNumber: number): Promise<PDFPageProxy>;
|
||||
};
|
||||
|
||||
export function getDocument(params: {
|
||||
data: Uint8Array;
|
||||
disableWorker?: boolean;
|
||||
}): { promise: Promise<PDFDocumentProxy> };
|
||||
}
|
||||
Reference in New Issue
Block a user