pdfmake. PDF document generation library for server-side and client-side usage in pure JavaScript. Features basics. line-wrapping; text-alignments (left, right, centered, justified) numbered and bulleted lists; margins; images and vector graphics; styling. convenient styling; style inheritance; custom style dictionaries; tables and columns
import * as pdfMake from "pdfmake/build/pdfmake"; import * as pdfFonts from 'pdfmake/build/vfs_fonts'; (< any > pdfMake). addVirtualFileSystem (pdfFonts);
Use in pdfmake on client-side. Is not supported by default, because this increase size of pdfmake library file about 700 kB. If you really need it, you can build with standard fonts by gulp buildWithStandardFonts command. Building with standard fonts from sources:
var docDefinition = {info: {title: 'awesome Document', author: 'john doe', subject: 'subject of document', keywords: 'keywords for document',}, content: 'This is an sample PDF printed with pdfMake'}
pdfmake follows a declarative approach. It basically means, you’ll never have to calculate positions manually or use commands like: writeText(text, x, y) , moveDown etc…, as you would with a lot of other libraries.
pdfMake. createPdf (docDefinition, tableLayouts, fonts, vfs) On the server side: var PdfPrinter = require ( 'pdfmake' ); var printer = new PdfPrinter ( fonts ); // Declaring your layout var myTableLayouts = { exampleLayout : { /* Your layout here.