forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jspdf.d.ts
203 lines (185 loc) · 7.74 KB
/
jspdf.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Type definitions for jsPDF v1.1.135
// Project: https://github.com/MrRio/jsPDF
// Definitions by: Amber Schühmacher <https://github.com/amberjs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class jsPDF {
constructor(orientation?:any,
unit?:string,
format?:string,
compressPdf?:number);
CapJoinStyles:any;
version:string;
internal: {
'pdfEscape'(text:string, flags:any): any;
'getStyle'(style:string) : any;
'getFont'(): any;
'getFontSize'():number;
'getLineHeight'():number;
'write'(string1:string):any;
'getCoordinateString'(value:number):number;
'getVerticalCoordinateString'(value:number):number;
'collections':any;
'newObject'():number;
'newAdditionalObject'():any;
'newObjectDeferred'():number;
'newObjectDeferredBegin'(oid:number):void;
'putStream'(str:string):void;
'events':any;
'scaleFactor':number;
'pageSize': {
width:number;
height:number;
};
'output'(type:any, options:any):any;
'getNumberOfPages'():number;
'pages':number[];
'out'(string:string):void;
'f2'(number:number):number;
'getPageInfo'(pageNumberOneBased:number):any;
'getCurrentPageInfo'():any;
};
addPage():jsPDF;
setPage(n:number):jsPDF;
insertPage(beforePage:number):jsPDF;
movePage(targetPage:number, beforePage:number):jsPDF;
deletePage(n:number):jsPDF;
setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF;
text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF;
lstext(text:string, x:number, y:number, spacing:number):jsPDF;
line(x1:number, y1:number, x2:number, y2:number):any;
clip():void;
lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF;
rect(x:number, y:number, w:number, h:number, style?:string):jsPDF;
triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF;
roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF;
ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF;
circle(x:number, y:number, r:number, style:string):jsPDF;
setProperties(properties:any):jsPDF;
setFontSize(size:number):jsPDF;
setFont(fontName?:string, fontStyle?:string):jsPDF;
setFontStyle(style:string):jsPDF;
setFontType(style:string):jsPDF;
getFontList():any;
addFont(postScriptName:string, fontName:string, fontStyle:string):string;
setLineWidth(width:number):jsPDF;
setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
setTextColor(r?:number, g?:number, b?:number):jsPDF;
setLineCap(style:string|number):jsPDF;
setLineJoin(style:string|number):jsPDF;
output(type?:string, options?:any):any;
save(filename:string):jsPDF;
/**
* jsPDF plugins below:
*
* - AddHTML
* - AddImage
* - Annotations
* - AutoPrint
* - Canvas
* - Cell
* - Context2D
* - FromHTML
* - JavaScript
* - PNG
* - split_text_to_size
* - SVG
* - total_pages
*/
// jsPDF plugin: addHTML
addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF;
addHTML(element:any, callback:Function):jsPDF;
// jsPDF plugin: addImage
color_spaces:any;
decode:any;
image_compression:any;
sHashCode(str:string):any;
isString(object:any):boolean;
extractInfoFromBase64DataURI(dataURI:string):any[];
supportsArrayBuffer():boolean;
isArrayBuffer(object:any):boolean;
isArrayBufferView(object:any):boolean;
binaryStringToUint8Array(binary_string:string):Uint8Array;
arrayBufferToBinaryString(buffer:any):string;
arrayBufferToBase64(arrayBuffer:ArrayBuffer):string;
createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any;
addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF;
processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any;
processJPG():any;
// jsPDF plugin: Annotations
annotationPlugin:any;
createAnnotation(options:any):void;
link(x:number, y:number, w:number, h:number, options:any):void;
textWithLink(text:string, x:number, y:number, options:any):number;
getTextWidth(text:string):number;
getLineHeight():number;
// jsPDF plugin: AutoPrint
autoPrint():jsPDF;
// jsPDF plugin: Canvas
canvas: {
getContext():any;
style:any;
};
// jsPDF plugin: Cell
setHeaderFunction(func:Function):void;
getTextDimensions(txt:string):any;
cellAddPage():void;
cellInitialize():void;
cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF;
arrayMax(array:any[], comparisonFn?:Function):number;
table(x:number, y:number, data:any, headers:string[], config:any):jsPDF;
calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number;
setTableHeaderRow(config:any[]):void;
printHeaderRow(lineNumber:number, new_page?:boolean):void;
// jsPDF plugin: Context2D
context2d: {
pageWrapXEnabled: boolean;
pageWrapYEnabled: boolean;
pageWrapX: number;
pageWrapY: number;
f2(number:number):number;
fillRect(x:number, y:number, w:number, h:number):void;
strokeRect(x:number, y:number, w:number, h:number):void;
clearRect(x:number, y:number, w:number, h:number):void;
save():void;
restore():void;
beginPath():void;
closePath():void;
setFillStyle(style:string):void;
setStrokeStyle(style:string):void;
fillText(text:string|string[], x:number, y:number, maxWidth:number):void;
strokeText(text:string|string[], x:number, y:number, maxWidth:number):void;
setFont(font:string):void;
setTextBaseline(baseline:string):void;
getTextBaseline():string;
setLineWidth(width:number):void;
setLineCap(style:string):void;
setLineJoin(style:string):void;
moveTo(x:number, y:number):void;
lastBreak: number;
pageBreaks: any[];
lineTo(x:number, y:number):void;
bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void;
quadraticCurveTo(x1:number, y1:number, x:number, y:number):void;
arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void;
drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void;
stroke():void;
fill():void;
translate(x:number, y:number):void;
measureText(text:string):number;
};
// jsPDF plugin: fromHTML
fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF;
// jsPDF plugin: JavaScript
addJS(txt:string):jsPDF;
// jsPDF plugin: PNG
processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any;
// jsPDF plugin: split_text_to_size
getCharWidthsArray(text:string, options?:any):any[];
getStringUnitWidth(text:string, options?:any):number;
splitTextToSize(text:string, maxlen:number, options?:any):any;
// jsPDF plugin: SVG
addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF;
// jsPDF plugin: total_pages
putTotalPages(pageExpression:string):jsPDF;
}