-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
50 lines (48 loc) · 979 Bytes
/
index.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
43
44
45
46
47
48
49
50
import $ from "jquery";
import moment from "moment";
import simpleInvoice from "./src/index.js";
import "pdfmake/vfs_fonts.js";
const pdf = simpleInvoice({
invertHeader: true,
organizationAddress: {
name: "Orbin",
street: "Strasse 333",
postCode: "3474",
city: "Stadt"
},
billingAddress: {
name: "Mein Kontakt",
attn: "Mr. Melk",
street: "Strasse 2",
postCode: "78556",
city: "Andere Stadt"
},
date: moment(),
dueDate: moment().add(12, "days"),
invoiceNumber: 12,
customerName: "MyCompany GmbH",
items: [{
name: "Item Name",
description: "Item Description",
quantity: 2,
rate: 200,
total: 400
}, {
name: "Item Name 2",
quantity: 2,
rate: 200,
total: 400
}],
subTotal: 400,
taxGroups: [{
name: "Mehrwertsteuer",
amount: 10
}],
adjustment: 20,
total: 430,
currency: "EUR",
note: "Meine Notiz"
});
pdf.getDataUrl((data) => {
$("iframe").attr("src", data);
});