Added sample definitions from pdfmake-examples and fixed model

This commit is contained in:
Enzo Volkmann
2018-10-18 11:06:57 +02:00
parent 2e84dad3b6
commit ac1e175785
3 changed files with 1298 additions and 11 deletions
File diff suppressed because one or more lines are too long
+5 -8
View File
@@ -96,11 +96,7 @@ declare module 'pdfmake/build/pdfmake' {
type Margins = number | [number, number] | [number, number, number, number];
interface Styles {
[key: string]: Style;
}
type Alignment = 'left' | 'right' | 'justify' | 'center';
type Alignment = 'left' | 'right' | 'justify' | 'center' | string;
interface Style {
font?: any;
@@ -120,7 +116,8 @@ declare module 'pdfmake/build/pdfmake' {
characterSpacing?: number;
noWrap?: boolean;
markerColor?: string;
leadingIndent?: any;
leadingIndent?: any;
[additionalProperty: string]: any;
}
type TableRowFunction = (row: number) => number;
@@ -176,11 +173,11 @@ declare module 'pdfmake/build/pdfmake' {
header?: TDocumentHeaderFooterFunction;
footer?: TDocumentHeaderFooterFunction;
content: string | Content;
styles?: Styles;
styles?: Style;
pageSize?: PageSize;
pageOrientation?: PageOrientation;
pageMargins?: Margins;
defaultStyle?: Styles;
defaultStyle?: Style;
}
type CreatedPdfParams = (
+6 -3
View File
@@ -1,10 +1,13 @@
import * as pdfMake from 'pdfmake/build/pdfmake';
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
const docDefinition = { content: 'This is an sample PDF printed with pdfMake' };
import definitions from './doc-definitions';
const createPdf = () => {
const pdf = pdfMake;
pdf.vfs = pdfFonts.pdfMake.vfs;
pdfMake.createPdf(docDefinition).download();
for (const key in definitions) {
const definition: pdfMake.TDocumentDefinitions = definitions[key];
pdfMake.createPdf(definition).download();
}
};