<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<title>my first pdfmake example</title>
<script src='https://rawgit.com/yelouafi/pdfmake/master/build/pdfmake.js'></script>
<script src='https://rawgit.com/bpampuch/pdfmake/master/build/vfs_fonts.js'></script>
</head>
<body>
<button onclick="open1()">Open</button>
<script>
var data = [];
data.push(['Header 1', 'Header 2', 'Header 3'])
for (var i = 1; i <= 10; i++) {
data.push([
{
text: 'Cell 1 #' + i,
fillColor: '#cecece'
},
'Cell 2 #' + i,
{
text: 'Cell 3 #' + i,
style: 'cell'
}
]);
}
data.push([
{ text: 'Col span', style: 'cell', colSpan: 2}, {},
{
text: 'Row span',
fillColor: 'yellow',
style: 'cell', fillColor: '#dedede',
rowSpan: 2
}
]);
data.push(['----', '----', {}])
var docDefinition = {
header: {
text: 'Table cells with fillColor support',
fontSize: 16,
alignment: 'center',
margin: [72, 40]
},
content: [{
table: {
headerRows: 1,
body: data
}
}],
styles: {
header: {
fontSize: 14,
bold: true
},
cell: {
color: 'red',
fillColor: 'yellow'
}
},
pageMargins: [72, 100, 72, 40]
};
function open1() {
pdfMake.createPdf(docDefinition).open()
}
</script>
</body>
</html>
// Code goes here
/* Styles go here */