@dlr-eoc/utils-browser
Version:
This library contains a collection of utilities like download data as blob and Paper layout.
28 lines (25 loc) • 1.1 kB
TypeScript
declare function downloadJson(data: object, fileName: string): void;
declare function downloadBlob(blob: Blob, fileName: string): void;
declare function downloadUrl(url: string, fileName: string): void;
type PaperFormat = 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6';
type Orientation = 'landscape' | 'portrait';
type Resolution = number;
/**
* A utility class intended to help with getting the dimensions of a paper.
* Especially useful for preparing html that needs to be printed.
*/
declare class Paper {
readonly format: PaperFormat;
readonly resolution: Resolution;
readonly orientation: Orientation;
readonly widthCm: number;
readonly heightCm: number;
readonly widthPx: number;
readonly heightPx: number;
constructor(format: PaperFormat, resolution: Resolution, orientation: Orientation);
updateFormat(format: PaperFormat): Paper;
updateResolution(resolution: Resolution): Paper;
updateOrientation(orientation: Orientation): Paper;
}
export { Paper, downloadBlob, downloadJson, downloadUrl };
export type { Orientation, PaperFormat, Resolution };