且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在离子2中使用pdfmake?

更新时间:2023-02-21 08:51:58

所以......再次......经过很多天,我终于通过pdfmake社区的帮助获得pdfmake来处理我的项目。

So... again... After many days, I finally get the pdfmake to work on my project with pdfmake community's help .

我克隆了编译版本进入www文件夹

I cloned the compiled version into the www folder

$ cd  project/www/
$ git clone https://github.com/bpampuch/pdfmake.git

然后我将脚本添加到索引中。

Then I added the scripts to the index.

<body>

  <!-- Ionic's root component and where the app will load -->
  <ion-app></ion-app>

  <!-- The polyfills js is generated during the build process -->
  <script src="build/polyfills.js"></script>

  <!-- The bundle js is generated during the build process -->
  <script src="build/main.js"></script>
  <script src='pdfmake/build/pdfmake.min.js'></script>
  <script src='pdfmake/build/vfs_fonts.js'></script>
</body>
</html>

并将导入替换为...

and replace import to ...

import * as pdfmake from 'pdfmake/build/pdfmake';

Pdfmake社区回复

Github进行项目测试