<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>my first export PDF</title>
<script src="pdfmake.min.js"></script>
<script src="vfs_fonts.js"></script>
<script>
function down() {
var dd = {
pageSize:'A4',
content: [
'This paragraph fills full width, as there are no columns. Next paragraph however consists of three columns',
{
columns: [
{
// auto-sized columns have their widths based on their content
width: 'auto',
text: '米哈搜房士大夫'
},
{
// star-sized columns fill the remaining space
// if there's more than one star-column, available width is divided equally
width: 'auto',
text: '您好地方'
},
{
// fixed width
width: 'auto',
text: '你好烦'
},
{
// percentage width
width: '10%',
text: 'Last column'
}
],
// optional space between columns
columnGap: 10
},
'This paragraph goes below all columns and has full width'
],
defaultStyle: {
font: 'msyh'
},
styles: {
per_info_header: {
fontSize: 24,
alignment: 'center'
},
per_info: {
alignment: 'center'
}
}
};
pdfMake.fonts = {
Roboto: {
normal: 'Roboto-Regular.ttf',
bold: 'Roboto-Medium.ttf',
italics: 'Roboto-Italic.ttf',
bolditalics: 'Roboto-Italic.ttf'
},
msyh: {
normal: 'msyh.ttf',
bold: 'msyh.ttf',
italics: 'msyh.ttf',
bolditalics: 'msyh.ttf',
}
};
pdfMake.createPdf(dd).download("test.pdf");
}
</script>
</head>
<body>
<button onclick="down()">下载dddd</button>
</body>
</html>