Support Unicode Characters in PDFmake library.
pdfmake is library for PDF printing in pure JavaScript.
By default pdfmake uses Roboto font, which does not support Unicode characters.
This package is an extension for adding unicode character support. It comes with a Arial GEO font, which has 4 styles: Regular, Bold, Italic and Bold Italic.
Install with NPM:
$ npm install pdfmake-unicode --save
Install with Yarn:
$ yarn add pdfmake-unicode
Install with Bower:
$ bower install pdfmake-unicode --save
Note: You don't need to include
vfs_fonts.js
file from pdfmake library.
<script src="pdfmake.min.js"></script>
<script src="dist/pdfmake-unicode.js"></script>
<script>
var docDefinition = { content: 'Your unicode text will go here.' };
pdfMake.createPdf(docDefinition).download('filename.pdf');
</script>
import pdfMake from 'pdfmake/build/pdfmake';
import pdfMakeUnicode from 'pdfmake-unicode';
// this part is crucial
pdfMake.vfs = pdfMakeUnicode.pdfMake.vfs;
let docDefinition = { content: 'Your unicode text will go here.' };
pdfMake.createPdf(docDefinition).download('filename.pdf');
- Georgian
- Russian
- Basic Latin
The PDFMake Unicode is open-sourced software licensed under the MIT license.