-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample_5_set_header_footer.js
42 lines (36 loc) · 1.07 KB
/
example_5_set_header_footer.js
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
// Exporting a dashboard
const path = require("path");
// Require FusionExport
const { ExportManager, ExportConfig } = require("fusionexport-node-client");
// Instantiate ExportManager
const exportManager = new ExportManager();
// Instantiate ExportConfig and add the required configurations
const exportConfig = new ExportConfig();
exportConfig.set(
"chartConfig",
path.join(__dirname, "resources", "multiple.json")
);
exportConfig.set(
"templateFilePath",
path.join(__dirname, "resources", "template.html")
);
exportConfig.set("pageMargin", {
top: "50px",
bottom: "50px",
left: "50px",
right: "50px"
});
exportConfig.set("headerComponents", { title: { style: "color:blue;" } });
exportConfig.set("footerComponents", { pageNumber: { style: "color:green;" } });
exportConfig.set("headerEnabled", true);
exportConfig.set("footerEnabled", "true");
exportConfig.set("type", "pdf");
// provide the export config
exportManager
.export(exportConfig, ".", true)
.then(exportedFiles => {
exportedFiles.forEach(file => console.log(file));
})
.catch(err => {
console.log(err);
});