You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-15Lines changed: 7 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,8 @@ Get jsPDF and this plugin by doing one of these things:
17
17
## Usage
18
18
19
19
```js
20
-
importjsPDFfrom'jspdf'
21
-
importautoTablefrom'jspdf-autotable'
20
+
import{ jsPDF }from'jspdf'
21
+
import{ autoTable }from'jspdf-autotable'
22
22
23
23
constdoc=newjsPDF()
24
24
@@ -36,17 +36,16 @@ autoTable(doc, {
36
36
],
37
37
})
38
38
39
-
// Sometimes you might have to call the default function on the export (for example in Deno)
40
-
autoTable.default(doc, { html:'#my-table' })
41
-
42
39
doc.save('table.pdf')
43
40
```
44
41
45
42
You can also use the plugin methods directly on the jsPDF documents:
46
43
47
44
```js
48
-
importjsPDFfrom'jspdf'
49
-
import'jspdf-autotable'
45
+
import { jsPDF } from'jspdf'
46
+
import { applyPlugin } from'jspdf-autotable'
47
+
48
+
applyPlugin(jsPDF)
50
49
51
50
constdoc=newjsPDF()
52
51
doc.autoTable({ html:'#my-table' })
@@ -239,17 +238,10 @@ autoTable(doc, {
239
238
-`doc.autoTable({ /* options */ })`
240
239
-`autoTable(doc, { /* options */ })`
241
240
-`jsPDF.autoTableSetDefaults({ /* ... */ })` Use for setting global defaults which will be applied for all tables
241
+
-`applyPlugin(jsPDF)` Use for adding the autoTable api to any jsPDF instance
242
242
243
243
If you want to know something about the last table that was drawn you can use `doc.lastAutoTable`. It has a `doc.lastAutoTable.finalY` property among other things that has the value of the last printed y coordinate on a page. This can be used to draw text, multiple tables or other content after a table.
244
244
245
-
In addition to the exported autoTable(doc, options) method you can also use applyPlugin to add the autoTable api to any jsPDF instance.
246
-
247
-
```
248
-
import jsPDF from 'jspdf/dist/jspdf.node.debug'
249
-
import { applyPlugin } from 'jspdf-autotable'
250
-
applyPlugin(jsPDF)
251
-
```
252
-
253
245
## Contributions
254
246
255
247
Contributions are always welcome, especially on open issues. If you have something major you want to add or change, please post an issue about it first to discuss it further. The workflow for contributing would be something like this:
0 commit comments