mindee
Version:
Mindee Client Library for Node.js
62 lines (61 loc) • 2.43 kB
TypeScript
import { PageOptions } from "../pageOptions";
import { InputSource, InputConstructor } from "./inputSource";
export declare const MIMETYPES: Map<string, string>;
export declare abstract class LocalInputSource extends InputSource {
inputType: string;
filename: string;
filepath?: string;
mimeType: string;
fileObject: Buffer | string;
/**
* @param {InputConstructor} constructor Constructor parameters.
*/
protected constructor({ inputType }: InputConstructor);
protected checkMimetype(): Promise<string>;
/**
* Returns the file object as a Buffer.
* @returns Buffer representation of the file object
* @protected
*/
protected getBuffer(): Buffer;
/**
* Determines whether the current file is a PDF.
* @returns {boolean} Returns true if the file is a PDF; otherwise, returns false.
*/
isPdf(): boolean;
/**
* Cut PDF pages.
* @param pageOptions
*/
applyPageOptions(pageOptions: PageOptions): Promise<void>;
/**
* Cut PDF pages.
* @param pageOptions
* @deprecated Deprecated in favor of {@link LocalInputSource.applyPageOptions}.
*/
cutPdf(pageOptions: PageOptions): Promise<void>;
/**
* Compresses the file object, either as a PDF or an image.
*
* @param quality Quality of the compression. For images, this is the JPEG quality.
* For PDFs, this affects image quality within the PDF.
* @param maxWidth Maximum width for image resizing. Ignored for PDFs.
* @param maxHeight Maximum height for image resizing. Ignored for PDFs.
* @param forceSourceText For PDFs, whether to force compression even if source text is present.
* @param disableSourceText For PDFs, whether to disable source text during compression.
*
* @returns A Promise that resolves when the compression is complete.
*/
compress(quality?: number, maxWidth?: number | null, maxHeight?: number | null, forceSourceText?: boolean, disableSourceText?: boolean): Promise<void>;
/**
* Returns true if the object is a PDF and has source text. False otherwise.
* @return boolean
*/
hasSourceText(): Promise<boolean>;
/**
* Returns the number of pages in the input source.
* For PDFs, returns the actual page count. For images, returns 1.
* @return Promise<number> The number of pages
*/
getPageCount(): Promise<number>;
}