我正在尝试使用pdfmake生成pdf。我在内容中使用表格,遇到错误ERROR File 'Roboto-Regular.ttf' not found in virtual file system
this.maintainanceLists.forEach(function(sourceRow) {
var dataRow = [];
dataRow.push(sourceRow.code_name);
dataRow.push(sourceRow.created_on);
dataRow.push(sourceRow.lease_id);
dataRow.push(sourceRow.property);
dataRow.push(sourceRow.unit);
bodyData.push(dataRow)
});
var docDefinition = {
content: [
{
table: {
body: bodyData
}
}
],
styles: {
story: {
italic: true,
alignment: 'center',
width: '100%',
}
}
}
this.pdfObj = pdfMake.createPdf(docDefinition);
我已经导入了pdffonts和pdfmake。
import pdfMake from 'pdfmake/build/pdfMake';
import pdfFonts from 'pdfmake/build/vfs_fonts';
pdfMake.vfs = pdfFonts.vfs;
在内容中使用文本时没有问题。问题是使用表格时