-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathindex.js
More file actions
114 lines (102 loc) · 2.41 KB
/
index.js
File metadata and controls
114 lines (102 loc) · 2.41 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
"use strict";
const MicroInvoice = require("../lib");
// Create the new invoice
let myInvoice = new MicroInvoice({
style : {
header : {
image : {
path : "./examples/logo.png",
width : 50,
height : 19
}
}
},
data : {
invoice : {
name : "Invoice",
header : [{
label : "Invoice Number",
value : 1
}, {
label : "Status",
value : "Paid afsdf asfdasd asf asdf as asdfasdf asd asd fasf"
}, {
label : "Date",
value : "22/10/21"
}],
currency : "EUR",
customer : [{
label : "Bill To",
value : [
"John Doe",
"Acme Corp",
"john.doe@gmail.com",
"+145453242342342",
"522 Main Street, New York",
"USA"
]
}, {
label : "Tax Identifier",
value : "352352342333"
}, {
label : "Information",
value : "Deliver to the door"
}
],
seller : [{
label : "Bill From",
value : [
"Big Corp",
"2 Flowers Streets, London",
"UK",
"+44245345435345",
"biling@bigcorp.com"
]
}, {
label : "Tax Identifier",
value : "5345345345435345345"
}],
legal : [{
value : "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
weight : "bold",
color : "primary"
}, {
value : "sed do eiusmod tempor incididunt ut labore et dolore magna.",
weight : "bold",
color : "secondary"
}],
details : {
header : [{
value : "Description"
}, {
value : "Quantity"
}],
parts : [
[{
value : "Nike Air Max Lorem ipsum dolor sit amet, consectetur adipiscing elit Lorem ipsum dolor sit amet, consectetur adipiscing elit Lorem ipsum dolor sit amet, consectetur adipiscing elit"
}, {
value : 1
}, {
value : "53",
price : true
}],
[{
value : "Discount"
}, {
value : 1
}, {
value : "-10",
price : true
}]
],
total : []
}
}
}
});
// Render invoice as PDF
myInvoice.generate("examples/example.pdf").then(() => {
console.log("Invoice saved");
}).catch((error) => {
console.error(error);
});