/// /// export interface PdfConvertOptions { /** * Path to ghostscript bin directory. * @default Included Windows version */ ghostscriptPath?: string; } export interface Pdf2PngOptions { /** * // resolution of the output image in dpi * @default 600 */ resolution?: number; } export interface PdfShrinkOptions { /** * // resolution of the output image in dpi * @default 300 */ resolution?: number; /** * // pdf version of the output shrunken pdf * @default same-version-as-input */ pdfVersion?: string; /** * // option to set the output as grey scale pdf * @default false */ greyScale?: boolean; } export declare class PdfConvert { private readonly options; private readonly source; private tmpFile; /** * Constructs a new Convert Object * @param source Can be either the buffer of the data, a file path, or a web url to a file. * @param options Configuration object */ constructor(source: Buffer | string, options?: PdfConvertOptions); /** * Convert a page to a png image. * @param page Page number * @param options Pdf2PngOptions * @return png image as buffer */ convertPageToImage(page: number, options?: Pdf2PngOptions): Promise; /** * Shrink/Compress pdf file * @param options PdfShrinkOptions * @returns shrunken pdf as buffer */ shrink(options?: PdfShrinkOptions): Promise; private getFileSizeInBytes; getPdfVersion(): Promise; /** * Gets the page count of the pdf. * @returns Number of pages in the pdf. */ getPageCount(): Promise; private tryParsePagesInt; /** * Writes the source file to a tmp location. */ private writePDFToTemp; /** * Removes the temp file created for the PDF conversion. * This should be called manually in case you want to do multiple operations. */ dispose(): Promise; }