文件不是从pdfmake.js下载的

时间:2018-09-26 11:03:41

标签: angularjs pdfmake

我什至无法下载使用pdfmake.js库创建为pdf文件的打开文件。我正在提供我的代码。当我向表发送数据时,它也给了我未定义的值。        另外,当我尝试打开创建的文件时,它给我类似TypeError的错误:无法在字符串“ test.pdf”上创建属性“ autoPrint”

  pdfCreatetor()
{ 
    var dd = {
        content: [
            {
                     {
    text: 'pdfmake', style: 'header' 
  },
  'pdf make does not generate pdf from the HTML. Rather, it generates them directly from javascript.',
        'It is very fast, but very limited, especially compared to PHP alternatives.',
        'To get a pdf that looks like the page, you could use html2canvas, which generates an image that can be inserted into the pdf. I think this is a hack and not ideal',
],
styles: 
{
    header: 
  {
            fontSize: 18,
            bold: true,
    margin: [0, 10, 0, 10],
    alignment: 'center'
        },
    tableHeader: 
  {
    fillColor: '#4CAF50',
        color: 'white'
  }
}
    };

    console.log("pdf make",pdfMake.createPdf(documentDefinition));
    pdfMake.createPdf(documentDefinition).open('test.pdf');
}

0 个答案:

没有答案