pdf-to-png-converter-allow-yarn
Version:
Node.js utility to convert PDF file/buffer pages to PNG files/buffers with no native dependencies.
29 lines (28 loc) • 1.22 kB
TypeScript
import { Canvas } from '@napi-rs/canvas';
import { CanvasAndContext } from './types';
export declare class NodeCanvasFactory {
/**
* Creates a new canvas context with the specified width and height.
* @param width The width of the canvas.
* @param height The height of the canvas.
* @returns A new canvas context with the specified width and height.
* @throws An error if the width or height is less than or equal to zero.
*/
create(width: number, height: number): {
canvas: Canvas;
context: import("@napi-rs/canvas").SKRSContext2D;
};
/**
* Resets the canvas to the specified width and height.
* @param canvasAndContext - The canvas and its context.
* @param width - The new width of the canvas.
* @param height - The new height of the canvas.
*/
reset(canvasAndContext: CanvasAndContext, width: number, height: number): void;
/**
* Destroys the canvas and its context by setting the canvas width and height to 0 and
* setting the canvas and context properties to undefined.
* @param canvasAndContext - The canvas and its context to be destroyed.
*/
destroy(canvasAndContext: CanvasAndContext): void;
}