forked from DanielBretzigheimer/svg2pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
70 lines (62 loc) · 2.07 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { jsPDF } from 'jspdf'
declare module 'svg2pdf.js' {
/**
* Renders an svg element to the current page of a jsPDF document.
* @param element The svg element.
* @param pdf The jsPDF document.
* @param options Optional options object.
* @return A promise resolving to the jsPDF document.
*/
export function svg2pdf(element: Element, pdf: jsPDF, options?: Svg2pdfOptions): Promise<jsPDF>
}
declare module 'jspdf' {
interface jsPDF {
/**
* Renders an svg element to the current page of a jsPDF document.
* @param element The svg element.
* @param options Optional options object.
* @return A promise resolving to the jsPDF document.
*/
svg(element: Element, options?: Svg2pdfOptions): Promise<jsPDF>
}
interface jsPDFAPI {
/**
* Renders an svg element to the current page of a jsPDF document.
* @param element The svg element.
* @param options Optional options object.
* @return A promise resolving to the jsPDF document.
*/
svg(this: jsPDF, element: Element, options?: Svg2pdfOptions): Promise<jsPDF>
}
}
/**
* Optional options that can be passed to {@link svg2pdf}.
*/
export interface Svg2pdfOptions {
/**
* The horizontal offset at which the SVG shall be rendered. The default is 0.
*/
x?: number
/**
* The vertical offset at which the SVG shall be rendered. The default is 0.
*/
y?: number
/**
* The desired width of the rendered SVG. Defines the initial viewport for
* the outermost SVG element. The {@link width} and {@link height} properties
* behave exactly like the width and height attributes on an HTML img element
* with an SVG image as source.
*/
width?: number
/**
* The desired height of the rendered SVG. See {@link width}.
*/
height?: number
/**
* Whether external style sheets referenced by SVG link elements or
* xml-stylesheets shall be loaded using HTTP requests.
* Note, that all style sheets that cannot be accessed because of CORS
* policies are ignored. The default is false.
*/
loadExternalStyleSheets?: boolean
}