@ztimson/momentum
Version:
Client library for momentum
50 lines • 1.79 kB
TypeScript
import { Api } from './api';
import { PathEventEmitter } from '@ztimson/utils';
/** Options when creating a PDF */
export type PdfOptions = {
/** Cookies PDF server should use */
cookies?: {
name: string;
value: string;
domain?: string;
path?: string;
}[];
/** Download after uploading */
download?: boolean;
/** Display page header/footer (The URL, page count, etc) */
displayHeaderFooter?: boolean;
/** Uploaded filename */
filename?: string;
/** Wait for x'ms of idle network traffic before creating PDF */
idleTime?: number;
/** Create the PDF in landscape orientation instead of portrait */
landscape?: boolean;
/** PDF Page margins */
margin?: {
top?: string;
left?: string;
right?: string;
bottom?: string;
};
/** Change the CSS media type */
mediaType?: 'screen' | 'print';
/** Enable background colors */
printBackground?: boolean;
/** Save PDF to storage location */
storagePath?: string;
/** Max amount of time request will wait before timing out */
timeout?: number;
/** Wait for custom dom event before continuing */
waitForEvent?: string;
/** Wait for builtin dom events before continuing */
waitUntil?: string[];
};
export declare class Pdf extends PathEventEmitter {
private readonly api;
constructor(api: Api | string);
private createPdf;
fromHtml(html: string, options?: PdfOptions): import('@ztimson/utils').PromiseProgress<any>;
fromTemplate(template: string, data: object, options?: PdfOptions): import('@ztimson/utils').PromiseProgress<any>;
fromUrl(url: string, options?: PdfOptions): import('@ztimson/utils').PromiseProgress<any>;
}
//# sourceMappingURL=pdf.d.ts.map