-
-
Save siteslave/0e5ad229beffc36917bb078237ce7e7d to your computer and use it in GitHub Desktop.
Invoice Template pdfMake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// try here http://pdfmake.org/playground.html | |
var dd = { | |
content: [ | |
{ | |
columns: [ | |
{ | |
image: | |
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABjCAYAAADeg0+zAAAACXBIWXMAABYlAAAWJQFJUiTwAAAQbUlEQVR42u1dh3tUVRbnf9hvv5WuJBAkhZKEJEAoZkICBKWpVAUERClSFQgl9CZIjYAiuAvLoq4FdEURRQQVFUGa9A5SpUsJ4ez9nXn35c3kvZk3aQQ49/t+32TevHLL+d1T7rkvZWrEPkECgcAeZaQTBAIhiEAgBBEIhCACgRBEIBCCCARCEIFACCIQCEEEAiGIQCAQgggEQhCBQAgiEAhBBAIhiEAgBBEIhCACgRBEIBCCCARCEOkIgUAIIhAIQQQCIYhAIAQRCIQgAoEQRCAQgggEQhCBQAgiEAiEIAKBEEQgEIIIBEIQgUAIIhAIQQQPOh6v08TVMSFIATuzuO7t9Cy35xXmOQVtZyjXBTq3IL/heEGeHxmXQlHxHh/g2P1IlDL3khi6s6rXbkzVajaiiFqNqJofIiyfOF93Pj7dDnoEX9/YdtDz6tCE6xCqYOrz8Il6oi3+z7F+Rvi1y7+t+notWG7r4v8M/34LRlzb61z2hXVc8D0sqgFVikigitXqMvA3jul2RcbdP0QpFRqkTr1mlNj4SYpLbmGLeAWcg/MfrZFEFVSnV41pyJ0daJbTv9Vt1JJiGzQPeF7NhKZch2ACFUhAcH2tpDRTyO0EEe1JUPWxayfqGF03lcKiG1DFCK9wgdhuiaJ/r9swgxJUXYD45AzXGqRuw5aW61pQjTrurkP9MB4YFxxLb9WFuvceQv0Gj2J06z2Y0p7qzP2Cc6rVbBgS+R9agkTFp1Dlx5NowdvL6Pr1v+jSpct09dp1W1y5cpX+vHiJ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2qjrqsOeYb6yh98IhNB96V+I4qbfoIvZl6n6hnKS+dQTwQuKhrvw0I/hBu+5KOK6Ag2gBh578byZidgLJ1MZNEgehbizNlUF/B9S5/7HXmegDOwjs5os6igb1bUuVmBtFnegl2wNob+dkWzHpZnuCGY03WhvlnR+sI7PUZ6o1Y0H0+xCZmX7teT3pevHi3o6ziL69WjBX2O870UYovuVaWhvJmxOMcmUD/La38EAnl5tUAgBBEIhCACgUAIIhAIQQQCIYhAIAQRCIQgAoEQRCAQgggEQhCBQAgiEAhBBAKBEEQgEIIIBEIQgUAIIhAIQQQCIYhAIAQRCIQgAoEQRCAQgkgnCARCEIFACCIQCEEEAiGIQCAEEQiEIAKBEEQgEIIIBA8hQfR/ERKEhkjzv2J5BA8wykQ6/DN7gT1q8P8NTOV/sFkuPJb/r1/5qnGCBxRlwqISSeAe4dFJVD6sJrXv2oeGj51Og0ZMpMGZkwQPKP4PnD+QxYAUEqIAAAAASUVORK5CYII=', | |
width: 150, | |
}, | |
[ | |
{ | |
text: 'Receipt', | |
color: '#333333', | |
width: '*', | |
fontSize: 28, | |
bold: true, | |
alignment: 'right', | |
margin: [0, 0, 0, 15], | |
}, | |
{ | |
stack: [ | |
{ | |
columns: [ | |
{ | |
text: 'Receipt No.', | |
color: '#aaaaab', | |
bold: true, | |
width: '*', | |
fontSize: 12, | |
alignment: 'right', | |
}, | |
{ | |
text: '00001', | |
bold: true, | |
color: '#333333', | |
fontSize: 12, | |
alignment: 'right', | |
width: 100, | |
}, | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: 'Date Issued', | |
color: '#aaaaab', | |
bold: true, | |
width: '*', | |
fontSize: 12, | |
alignment: 'right', | |
}, | |
{ | |
text: 'June 01, 2016', | |
bold: true, | |
color: '#333333', | |
fontSize: 12, | |
alignment: 'right', | |
width: 100, | |
}, | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: 'Status', | |
color: '#aaaaab', | |
bold: true, | |
fontSize: 12, | |
alignment: 'right', | |
width: '*', | |
}, | |
{ | |
text: 'PAID', | |
bold: true, | |
fontSize: 14, | |
alignment: 'right', | |
color: 'green', | |
width: 100, | |
}, | |
], | |
}, | |
], | |
}, | |
], | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: 'From', | |
color: '#aaaaab', | |
bold: true, | |
fontSize: 14, | |
alignment: 'left', | |
margin: [0, 20, 0, 5], | |
}, | |
{ | |
text: 'To', | |
color: '#aaaaab', | |
bold: true, | |
fontSize: 14, | |
alignment: 'left', | |
margin: [0, 20, 0, 5], | |
}, | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: 'Your Name \n Your Company Inc.', | |
bold: true, | |
color: '#333333', | |
alignment: 'left', | |
}, | |
{ | |
text: 'Client Name \n Client Company', | |
bold: true, | |
color: '#333333', | |
alignment: 'left', | |
}, | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: 'Address', | |
color: '#aaaaab', | |
bold: true, | |
margin: [0, 7, 0, 3], | |
}, | |
{ | |
text: 'Address', | |
color: '#aaaaab', | |
bold: true, | |
margin: [0, 7, 0, 3], | |
}, | |
], | |
}, | |
{ | |
columns: [ | |
{ | |
text: '9999 Street name 1A \n New-York City NY 00000 \n USA', | |
style: 'invoiceBillingAddress', | |
}, | |
{ | |
text: '1111 Other street 25 \n New-York City NY 00000 \n USA', | |
style: 'invoiceBillingAddress', | |
}, | |
], | |
}, | |
'\n\n', | |
{ | |
width: '100%', | |
alignment: 'center', | |
text: 'Invoice No. 123', | |
bold: true, | |
margin: [0, 10, 0, 10], | |
fontSize: 15, | |
}, | |
{ | |
layout: { | |
defaultBorder: false, | |
hLineWidth: function(i, node) { | |
return 1; | |
}, | |
vLineWidth: function(i, node) { | |
return 1; | |
}, | |
hLineColor: function(i, node) { | |
if (i === 1 || i === 0) { | |
return '#bfdde8'; | |
} | |
return '#eaeaea'; | |
}, | |
vLineColor: function(i, node) { | |
return '#eaeaea'; | |
}, | |
hLineStyle: function(i, node) { | |
// if (i === 0 || i === node.table.body.length) { | |
return null; | |
//} | |
}, | |
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, | |
paddingLeft: function(i, node) { | |
return 10; | |
}, | |
paddingRight: function(i, node) { | |
return 10; | |
}, | |
paddingTop: function(i, node) { | |
return 2; | |
}, | |
paddingBottom: function(i, node) { | |
return 2; | |
}, | |
fillColor: function(rowIndex, node, columnIndex) { | |
return '#fff'; | |
}, | |
}, | |
table: { | |
headerRows: 1, | |
widths: ['*', 80], | |
body: [ | |
[ | |
{ | |
text: 'ITEM DESCRIPTION', | |
fillColor: '#eaf2f5', | |
border: [false, true, false, true], | |
margin: [0, 5, 0, 5], | |
textTransform: 'uppercase', | |
}, | |
{ | |
text: 'ITEM TOTAL', | |
border: [false, true, false, true], | |
alignment: 'right', | |
fillColor: '#eaf2f5', | |
margin: [0, 5, 0, 5], | |
textTransform: 'uppercase', | |
}, | |
], | |
[ | |
{ | |
text: 'Item 1', | |
border: [false, false, false, true], | |
margin: [0, 5, 0, 5], | |
alignment: 'left', | |
}, | |
{ | |
border: [false, false, false, true], | |
text: '$999.99', | |
fillColor: '#f5f5f5', | |
alignment: 'right', | |
margin: [0, 5, 0, 5], | |
}, | |
], | |
[ | |
{ | |
text: 'Item 2', | |
border: [false, false, false, true], | |
margin: [0, 5, 0, 5], | |
alignment: 'left', | |
}, | |
{ | |
text: '$999.99', | |
border: [false, false, false, true], | |
fillColor: '#f5f5f5', | |
alignment: 'right', | |
margin: [0, 5, 0, 5], | |
}, | |
], | |
], | |
}, | |
}, | |
'\n', | |
'\n\n', | |
{ | |
layout: { | |
defaultBorder: false, | |
hLineWidth: function(i, node) { | |
return 1; | |
}, | |
vLineWidth: function(i, node) { | |
return 1; | |
}, | |
hLineColor: function(i, node) { | |
return '#eaeaea'; | |
}, | |
vLineColor: function(i, node) { | |
return '#eaeaea'; | |
}, | |
hLineStyle: function(i, node) { | |
// if (i === 0 || i === node.table.body.length) { | |
return null; | |
//} | |
}, | |
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, | |
paddingLeft: function(i, node) { | |
return 10; | |
}, | |
paddingRight: function(i, node) { | |
return 10; | |
}, | |
paddingTop: function(i, node) { | |
return 3; | |
}, | |
paddingBottom: function(i, node) { | |
return 3; | |
}, | |
fillColor: function(rowIndex, node, columnIndex) { | |
return '#fff'; | |
}, | |
}, | |
table: { | |
headerRows: 1, | |
widths: ['*', 'auto'], | |
body: [ | |
[ | |
{ | |
text: 'Payment Subtotal', | |
border: [false, true, false, true], | |
alignment: 'right', | |
margin: [0, 5, 0, 5], | |
}, | |
{ | |
border: [false, true, false, true], | |
text: '$999.99', | |
alignment: 'right', | |
fillColor: '#f5f5f5', | |
margin: [0, 5, 0, 5], | |
}, | |
], | |
[ | |
{ | |
text: 'Payment Processing Fee', | |
border: [false, false, false, true], | |
alignment: 'right', | |
margin: [0, 5, 0, 5], | |
}, | |
{ | |
text: '$999.99', | |
border: [false, false, false, true], | |
fillColor: '#f5f5f5', | |
alignment: 'right', | |
margin: [0, 5, 0, 5], | |
}, | |
], | |
[ | |
{ | |
text: 'Total Amount', | |
bold: true, | |
fontSize: 20, | |
alignment: 'right', | |
border: [false, false, false, true], | |
margin: [0, 5, 0, 5], | |
}, | |
{ | |
text: 'USD $999.99', | |
bold: true, | |
fontSize: 20, | |
alignment: 'right', | |
border: [false, false, false, true], | |
fillColor: '#f5f5f5', | |
margin: [0, 5, 0, 5], | |
}, | |
], | |
], | |
}, | |
}, | |
'\n\n', | |
{ | |
text: 'NOTES', | |
style: 'notesTitle', | |
}, | |
{ | |
text: 'Some notes goes here \n Notes second line', | |
style: 'notesText', | |
}, | |
], | |
styles: { | |
notesTitle: { | |
fontSize: 10, | |
bold: true, | |
margin: [0, 50, 0, 3], | |
}, | |
notesText: { | |
fontSize: 10, | |
}, | |
}, | |
defaultStyle: { | |
columnGap: 20, | |
//font: 'Quicksand', | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment