Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions docs/api/export/pdf_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ To avoid problems during export, all images for Diagram shapes must be set eithe
### Usage

~~~jsx
pdf(config?: object): void;
pdf(config?: object): Promise<void>;
~~~

### Returns

A promise of data export

### Parameters

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

### Example

~~~jsx {7,10-13}
~~~jsx
const diagram = new dhx.Diagram("diagram_container", {
// config options
});
diagram.data.parse(data);

// default export
diagram.export.pdf();
diagram.export.pdf()
.then(() => console.log("success"))
.catch(() => console.log("failure"))
.finally(() => console.log("finished"));

// export with config settings
diagram.export.pdf({
url: "https://export.dhtmlx.com/diagram/pdf/5.0.0",
name:"result_pdf"
});
})
.then(() => console.log("success"))
.catch(() => console.log("failure"))
.finally(() => console.log("finished"));
~~~

### Details
Expand Down
18 changes: 14 additions & 4 deletions docs/api/export/png_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ To avoid problems during export, all images for Diagram shapes must be set eithe
### Usage

~~~jsx
png(config?: object): void;
png(config?: object): Promise<void>;
~~~

### Returns

A promise of data export

### Parameters

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

### Example

~~~jsx {7,10-13}
~~~jsx
const diagram = new dhx.Diagram("diagram_container", {
// config options
});
diagram.data.parse(data);

// default export
diagram.export.png();
diagram.export.png()
.then(() => console.log("success"))
.catch(() => console.log("failure"))
.finally(() => console.log("finished"));

// export with config settings
diagram.export.png({
name: "result_png"
});
})
.then(() => console.log("success"))
.catch(() => console.log("failure"))
.finally(() => console.log("finished"));
~~~

**Related articles**: [Exporting Diagram](../../../guides/data_export/)
Expand Down
Loading