Skip to content

Commit 573e40a

Browse files
committed
[update] descriptions of the pdf() and png() methods
1 parent 34645d0 commit 573e40a

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

docs/api/export/pdf_method.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ To avoid problems during export, all images for Diagram shapes must be set eithe
1717
### Usage
1818

1919
~~~jsx
20-
pdf(config?: object): void;
20+
pdf(config?: object): Promise<void>;
2121
~~~
2222

23+
### Returns
24+
25+
A promise of data export
26+
2327
### Parameters
2428

2529
- `config` - (optional) an object with export settings. You can specify the following settings for export to PDF:
@@ -53,20 +57,26 @@ pdf(config?: object): void;
5357

5458
### Example
5559

56-
~~~jsx {7,10-13}
60+
~~~jsx
5761
const diagram = new dhx.Diagram("diagram_container", {
5862
// config options
5963
});
6064
diagram.data.parse(data);
6165

6266
// default export
63-
diagram.export.pdf();
67+
diagram.export.pdf()
68+
.then(() => console.log("success"))
69+
.catch(() => console.log("failure"))
70+
.finally(() => console.log("finished"));
6471

6572
// export with config settings
6673
diagram.export.pdf({
6774
url: "https://export.dhtmlx.com/diagram/pdf/5.0.0",
6875
name:"result_pdf"
69-
});
76+
})
77+
.then(() => console.log("success"))
78+
.catch(() => console.log("failure"))
79+
.finally(() => console.log("finished"));
7080
~~~
7181

7282
### Details

docs/api/export/png_method.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ To avoid problems during export, all images for Diagram shapes must be set eithe
1717
### Usage
1818

1919
~~~jsx
20-
png(config?: object): void;
20+
png(config?: object): Promise<void>;
2121
~~~
2222

23+
### Returns
24+
25+
A promise of data export
26+
2327
### Parameters
2428

2529
- `config` - (optional) an object with export settings. You can specify the following settings for export to PNG:
@@ -30,19 +34,25 @@ png(config?: object): void;
3034

3135
### Example
3236

33-
~~~jsx {7,10-13}
37+
~~~jsx
3438
const diagram = new dhx.Diagram("diagram_container", {
3539
// config options
3640
});
3741
diagram.data.parse(data);
3842

3943
// default export
40-
diagram.export.png();
44+
diagram.export.png()
45+
.then(() => console.log("success"))
46+
.catch(() => console.log("failure"))
47+
.finally(() => console.log("finished"));
4148

4249
// export with config settings
4350
diagram.export.png({
4451
name: "result_png"
45-
});
52+
})
53+
.then(() => console.log("success"))
54+
.catch(() => console.log("failure"))
55+
.finally(() => console.log("finished"));
4656
~~~
4757

4858
**Related articles**: [Exporting Diagram](../../../guides/data_export/)

0 commit comments

Comments
 (0)