UNPKG

ns-mapbox-gl-export

Version:

This module adds control which can export PDF and images.

75 lines (74 loc) 2.32 kB
import 'jspdf-autotable'; import { Map as MapboxMap } from 'mapbox-gl'; import 'js-loading-overlay'; type PDFOptions = { title?: string; subTitle?: string; logo?: string; scale?: string; hideFooter?: boolean; hideTitle?: boolean; logoSize?: any; logoBase64?: string; }; export declare const Format: { readonly JPEG: "jpg"; readonly PNG: "png"; readonly PDF: "pdf"; readonly SVG: "svg"; }; export declare const Unit: { readonly in: "in"; readonly mm: "mm"; }; type Unit = (typeof Unit)[keyof typeof Unit]; export declare const Size: { readonly '4.1 x 5.8 (A6)': readonly [148, 105]; readonly '4.9 x 6.9 (B6)': readonly [176, 125]; readonly '5.8 x 8.3 (A5)': readonly [210, 148]; readonly '6.9 x 9.8 (B5)': readonly [250, 176]; readonly '8.3 x 11.7 (A4)': readonly [297, 210]; readonly '8.5 x 11 (LETTER)': readonly [279, 216]; readonly '9.8 x 13.9 (B4)': readonly [353, 250]; readonly '11.7 x 16.5 (A3)': readonly [420, 297]; readonly '11 x 17 (TABLOID)': readonly [420, 297]; readonly '13.9 x 19.7 (B3)': readonly [500, 353]; readonly '16.5 x 23.4 (A2)': readonly [594, 420]; readonly '19.7 x 27.8 (B2)': readonly [707, 500]; readonly '22 x 34 (D)': readonly [863, 558]; readonly '24 x 36 (E)': readonly [914, 609]; }; type Size = (typeof Size)[keyof typeof Size]; export declare const PageOrientation: { readonly Landscape: "landscape"; readonly Portrait: "portrait"; }; export declare const DPI: { readonly 72: 72; readonly 96: 96; readonly 200: 200; readonly 300: 300; readonly 400: 400; }; export default class MapGenerator { private map; private width; private height; private dpi; private format; private unit; private accessToken; private logoURL; private adjustment; constructor(map: MapboxMap, size?: Size, dpi?: number, format?: string, unit?: Unit, accessToken?: string, logoURL?: string, adjustment?: number); generate(loader?: boolean, fName?: string, pdfOptions?: PDFOptions, callback?: (error: any, data: any) => void): void; private toPNG; private toJPEG; private toPDF; private toSVG; private toPixels; private padTo2Digits; private formatDate; private getMapScaleInFeets; } export {};