跳至正文
Wener Notes

pdfmake

约 1 分钟阅读
    • MIT, JS
    • 使用 pdfkit, xmldoc 生成 PDF
TypeScript
// PdfPrinter 用于 Node.js
import PdfPrinter from 'pdfmake';

// createPdf 用于浏览器
import createPdf from 'pdfmake/build/pdfmake';

// 文档内容
import type { TDocumentDefinitions } from 'pdfmake/interfaces';
TypeScript
export type Content =
  | string // =ContentText
  | number
  | Content[] // =ContentStack
  | ContentText
  | ContentColumns
  | ContentStack
  | ContentUnorderedList
  | ContentOrderedList
  | ContentTable
  | ContentAnchor
  | ContentPageReference
  | ContentTextReference
  | ContentToc
  | ContentTocItem
  | ContentImage
  | ContentSvg
  | ContentQr
  | ContentCanvas;

FAQ

内存问题

  1. 关闭 fontLayoutCache
  2. 拆分为多个 pdf 然后合并

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub3 条
其他外链1 条
最近更新commit 92ccd87编辑