0.0.3 • Published 4 years ago

pdfmake-zh v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

pdfmake Build Status GitHub npm Bower Packagist CDNJS

为什么有这个 fork?

  • pdfmake 默认使用英文字体,该 fork 替换英文字体为开源的思源黑体
  • 为减少字体文件大小,只使用了常规字体,因此设置字体为斜体和粗体时,字体依然显示常规字体

Why this fork?

  • pdfmake uses English fonts by default, and the fork replaces the English fonts with the open source Siyuan boldface
  • In order to reduce the font file size, only regular fonts are used, so when the font is set to italics and bold, the font still displays regular fonts
var pdfMake = require('pdfmake-zh/build/pdfmake.js');
var pdfFonts = require('pdfmake-zh/build/vfs_fonts.js');
pdfMake.vfs = pdfFonts.pdfMake.vfs;

or

import pdfMake from "pdfmake-zh/build/pdfmake";
import pdfFonts from "pdfmake-zh/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;
pdfMake.fonts = {
	SourceHanSC: {
		normal: "SourceHanSansCN-Regular.ttf",
		bold: "SourceHanSansCN-Regular.ttf",
		italics: "SourceHanSansCN-Regular.ttf",
		bolditalics: "SourceHanSansCN-Regular.ttf",
	},
};

PDF document generation library for server-side and client-side in pure JavaScript.

Check out the playground and examples.

This is unstable master branch for version 0.2.x, for stable version 0.1.x see branch 0.1.

Features

  • line-wrapping,
  • text-alignments (left, right, centered, justified),
  • numbered and bulleted lists,
  • tables and columns
    • auto/fixed/star-sized widths,
    • col-spans and row-spans,
    • headers automatically repeated in case of a page-break,
  • images and vector graphics,
  • convenient styling and style inheritance,
  • page headers and footers:
    • static or dynamic content,
    • access to current page number and page count,
  • background-layer,
  • page dimensions and orientations,
  • margins,
  • custom page breaks,
  • font embedding,
  • support for complex, multi-level (nested) structures,
  • table of contents,
  • helper methods for opening/printing/downloading the generated PDF,
  • setting of PDF metadata (e.g. author, subject).

Documentation

Documentation URL: https://pdfmake.github.io/docs/

Building from sources

using npm:

git clone https://github.com/bpampuch/pdfmake.git
cd pdfmake
npm install
npm run build

using yarn:

git clone https://github.com/bpampuch/pdfmake.git
cd pdfmake
yarn
yarn run build

License

MIT

Authors

pdfmake is based on a truly amazing library pdfkit (credits to @devongovett).

Thanks to all contributors.