Skip to content

Commit 54cca08

Browse files
Update readme for v5
1 parent a15109d commit 54cca08

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Get jsPDF and this plugin by doing one of these things:
1717
## Usage
1818

1919
```js
20-
import jsPDF from 'jspdf'
21-
import autoTable from 'jspdf-autotable'
20+
import { jsPDF } from 'jspdf'
21+
import { autoTable } from 'jspdf-autotable'
2222

2323
const doc = new jsPDF()
2424

@@ -36,17 +36,16 @@ autoTable(doc, {
3636
],
3737
})
3838

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-
4239
doc.save('table.pdf')
4340
```
4441

4542
You can also use the plugin methods directly on the jsPDF documents:
4643

4744
```js
48-
import jsPDF from 'jspdf'
49-
import 'jspdf-autotable'
45+
import { jsPDF } from 'jspdf'
46+
import { applyPlugin } from 'jspdf-autotable'
47+
48+
applyPlugin(jsPDF)
5049

5150
const doc = new jsPDF()
5251
doc.autoTable({ html: '#my-table' })
@@ -239,17 +238,10 @@ autoTable(doc, {
239238
- `doc.autoTable({ /* options */ })`
240239
- `autoTable(doc, { /* options */ })`
241240
- `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
242242

243243
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.
244244

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-
253245
## Contributions
254246

255247
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

Comments
 (0)