npm.io
1.4.6 • Published 2 years ago

@types/jsreport-phantom-pdf

Licence
MIT
Version
1.4.6
Deps
1
Size
6 kB
Vulns
0
Weekly
0
Stars
51.3K

Installation

npm install --save @types/jsreport-phantom-pdf

Summary

This package contains type definitions for jsreport-phantom-pdf (https://github.com/jsreport/jsreport-phantom-pdf).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsreport-phantom-pdf.

index.d.ts

import { ExtensionDefinition, Template } from "jsreport-core";

declare namespace JsReportPhantomPdf {
    interface Margin {
        left: number | string;
        right: number | string;
        top: number | string;
        bottom: number | string;
    }

    interface Phantom {
        margin: string | Margin;
        header: string;
        footer: string;
        width: string;
        height: string;
        headerHeight: string;
        footerHeight: string;
        format: string;
        orientation: "portrait" | "landscape";
        blockJavaScript: boolean;
        resourceTimeout: number;
        waitForJS: boolean;
        fitToPage: boolean;
        customPhantomJS: boolean;
        phantomjsVersion: string;
    }

    // const enum PhantomStrategy {
    //   dedicatedProcess = 'dedicated-process',
    //   phantomServer = 'phantom-server'
    // }

    interface Options {
        allowLocalFilesAccess: boolean;
        // appDirectory: string;
        defaultPhantomjsVersion: string;
        strategy: "dedicated-process" | "phantom-server";
        timeout: number;
    }

    // without exporting enum, it doesn't include the require('jsreport-core') in the test.js for some reason
    // help welcome
    // export enum Foo { }

    interface PhantomPDFTemplate extends Template {
        phantom?: Partial<Phantom> | undefined;
        recipe: "phantom-pdf" | string;
    }
}

declare module "jsreport-core" {
    interface TemplateRegistry {
        PhantomPDFTemplate: JsReportPhantomPdf.PhantomPDFTemplate;
    }
}

declare function JsReportPhantomPdf(options?: Partial<JsReportPhantomPdf.Options>): ExtensionDefinition;

export = JsReportPhantomPdf;

Additional Details

Credits

These definitions were written by taoqf.