# PDFMake Chinese




## Getting Started

> [pdfmake](https://github.com/bpampuch/pdfmake) is library for PDF printing in pure JavaScript.

By default pdfmake uses [Roboto](https://fonts.google.com/specimen/Roboto) font, which does not support Chinese characters.

This package is an extension for adding Chinese character support. It comes with a 方正黑体简体 font, which has 4 styles: Regular, **Bold**, *Italic* and ***Bold Italic***.

## Installation


Install with [NPM](https://www.npmjs.com):

```
$ npm install pdfmake-chinese --save
```

Install with [Yarn](https://yarnpkg.com/):

```
$ yarn add pdfmake-chinese
```

Install with [Bower](https://bower.io/):

```
$ bower install pdfmake-chinese --save
```

## Usage



```html
<script src="pdfmake.min.js"></script>
<script src="vfs_fonts.js"></script>
<script>

  var docDefinition = { content: '我支持中文啦' };
      pdfMake.fonts = {
        方正黑体简体: {
            normal: '方正黑体简体.TTF',
            bold: '方正黑体简体.TTF',
            italics: '方正黑体简体.TTF',
            bolditalics: '方正黑体简体.TTF',
            }
        };
        defaultStyle: {
            font: '方正黑体简体'
            }
          };
  pdfMake.createPdf(docDefinition).download('filename.pdf');
</script>

```
### Use with ES6

```js
import pdfMake from 'pdfmake-chinese/pdfmake';
import pdfFonts from 'pdfmake-chinese/vfs_fonts';

pdfMake.vfs = pdfFonts.pdfMake.vfs;

var docDefinition = { content: '我支持中文啦' };
      pdfMake.fonts = {
         Roboto: {
            normal: 'fonts/Roboto-Regular.ttf',
            bold: 'fonts/Roboto-Medium.ttf',
            italics: 'fonts/Roboto-Italic.ttf',
            bolditalics: 'fonts/Roboto-MediumItalic.ttf'
        },
    
        方正黑体简体: {
            normal: '方正黑体简体.TTF',
            bold: '方正黑体简体.TTF',
            italics: '方正黑体简体.TTF',
            bolditalics: '方正黑体简体.TTF',
            }
        };
        defaultStyle: {
            font: '方正黑体简体'
            }
          };
  pdfMake.createPdf(docDefinition).download('filename.pdf');

```

## Supported Languages
* Chinese

## Licence

