-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathdemo17.js
More file actions
63 lines (54 loc) · 2.02 KB
/
Copy pathdemo17.js
File metadata and controls
63 lines (54 loc) · 2.02 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"use strict";
var Report = require('../lib/fluentReports').Report;
var displayReport = require('./reportDisplayer');
global.perfTime = 0;
function printReport() {
var reportData = [],
firstString = 'First 50',
secondString = 'Second column 100',
thirdString = 'Third Column is lengthy at 200';
for (var i = 0; i < 50; ++i) {
reportData.push({
first: firstString + Array(i).join('x'),
second: secondString + Array(i).join('x'),
third: thirdString + Array(i).join('x')
});
reportData.push({
first: firstString + Array(i).join('W'),
second: secondString + Array(i).join('W'),
third: thirdString + Array(i).join('W')
});
reportData.push({
first: firstString + Array(i).join('i'),
second: secondString + Array(i).join('i'),
third: thirdString + Array(i).join('i')
});
reportData.push({
first: firstString + Array(i).join('Wi'),
second: secondString + Array(i).join('Wi'),
third: thirdString + Array(i).join('Wi')
});
}
var detailFunction = function (report, data) {
report.band([
{data: data.first, width: 50},
{data: data.second, width: 100},
{data: data.third, width: 200}
], {border: 1, width: 0});
};
var reportName = "demo17.pdf";
var rpt = new Report(reportName, {font: "Arimo"})
.registerFont("Arimo", {normal: __dirname+'/Fonts/Arimo-Regular.ttf', bold: __dirname+'/Fonts/Arimo-Bold.ttf', 'italic': __dirname+'/Fonts/Arimo-Italic.ttf'})
.autoPrint(false)
.data(reportData)
.detail(detailFunction)
.fontSize(10);
console.time("Rendered");
rpt.render(function (error, name) {
console.timeEnd("Rendered");
const testing = {images: 4};
displayReport(error, name, testing);
});
if (typeof process.env.TESTING === "undefined") { rpt.printStructure(true); }
}
printReport();