pdf
4.6/519

pdfmake

npm i pdfmake

77 Versions

0.3.0-beta.2

beta
5 months ago

Prerelease version. Do not use in a production.

Installation
npm install pdfmake@0.3.0-beta.2
Changelog
  • Attachments embedding
  • Support passing headers to request for loading font files and images via URL adresses
Documentation

Documentation for version 0.3: here Migration guide: here


0.2.5

latest
5 months ago
  • Support passing headers to request for loading font files and images via URL adresses

0.3.0-beta.1

8 months ago

Prerelease version. Do not use in a production.

Installation
npm install pdfmake@0.3.0-beta.1
Changelog
  • Port code base to ES6+
  • Unify interface for node and browser (breaking change)
  • All methods return promise instead of using callback (breaking change)
  • Change including virtual font storage in client-side (breaking change)
  • Change parameters of pageBreakBefore function (breaking change)
  • Support for loading font files and images via URL adresses (https:// or http:// protocol) in Node.js (client and server side now)
Documentation

Documentation for version 0.3: here Migration guide: here


0.2.4

9 months ago
  • Fixed destination path argument in VFS build script.
  • Fixed error "Object.isExtensible is not a function" (bug is in core-js version 3.19.1).

0.2.3

9 months ago
  • Updated @foliojs-fork/pdfkit to version 0.13.0.
  • Tiling pattern support.
  • svg-to-pdfkit package moved as built-in. Solve not used installation of pdfkit.
  • Fixed passing document metadata.

0.2.2

1 year ago
  • Fixed compatibility with Internet Explorer 11

0.2.1

1 year ago

0.2.0

1 year ago

0.1.72

1 year ago
  • Introduced new build-vfs.js script to build virtual file system for fonts (see documentation).
  • Updated pdfkit (version 0.12.1).

0.1.71

1 year ago
  • update pdfkit (version 0.12.0)
  • update Roboto font (version 3.004)
  • fix performance problem for pageBreakBefore in large documents

0.1.70

2 years ago
  • fixed compatibility with Internet Explorer

0.1.69

2 years ago

0.1.68

2 years ago
  • fixed error window is not defined in Node.js

0.1.67

2 years ago
  • fixed include Promise polyfill
  • experimental SVG: rewrited SVG parsing
  • client-side: images file loading via url address (https:// or http:// protocol) in "images" dictionary Example of usage:
var dd = {
    content: [
        {
            image: 'testImage'
        }
    ],
    images: {
        testImage: 'https://picsum.photos/seed/picsum/200/300',
    }
};

This is not supported: { image: 'https://picsum.photos/seed/picsum/200/300' }


0.1.66

2 years ago

0.1.65

2 years ago
  • support of fillOpacity property in tables
  • support of linkToPage and linkToDestination with images
  • pageBreakBefore performance improvement
  • fix support opacity with number 0

0.1.64

3 years ago
  • added new values for pageBreak:
    • beforeOdd, afterOdd - break to odd page
    • beforeEven, afterEven - break to even page
  • fixed pageMargins: 0
  • experimental SVG - fixed too bold and too italics text

0.1.63

3 years ago
  • update pdfkit to 0.11.0
  • add support to interlaced PNG files

0.1.62

3 years ago
  • experimental SVG - default font for unknown fonts is used from defaultStyle element. Or can be defined in svg node via font property
  • experimental SVG - fixed finding fonts

0.1.61

3 years ago
  • experimental svg - fix text rendering
  • table - fix border rendering

0.1.60

3 years ago
  • watermark - add fontSize to own setting and angle to own text rotate, see documentation
  • watermark - fix calculation for automatic font size
  • table - fix borderColor

0.1.59

3 years ago
  • experimental SVG nodes is build-in by default now
  • fix svg with decimal numbers
  • fix svg rendering in header and footer
  • fix border borderColor in table

0.1.58

3 years ago
  • support SVG nodes (experimental) see documentation and example
  • fix table border with colSpan
  • fix rendering empty ToC

0.1.57

3 years ago
  • update pdfkit to 0.10.0
  • added feature link to destination via linkToDestination property (see links example)
  • ToC - links to destination support with title and page number

0.1.56

3 years ago
  • fix crash with rendering table of content
  • add support for linear gradient to ellipse

0.1.55

3 years ago
  • update pdfkit to 0.9.1
  • add borderColor for table cell (example borderColor: ['#ff00ff', '#00ffff', '#ff00ff', '#00ffff'] and see table example)
  • cache can be disabled via fontLayoutCache option. Example: printer.createPdfKitDocument(docDefinition, { fontLayoutCache: false }) on server-side and pdfMake.createPdf(docDefinition).download('document.pdf', null, { fontLayoutCache: false }); on client-side
  • normalized readFileSync method parameters in virtual file system same as in node.js
  • improved throwing of exception for opening image
  • fix download() options might be dropped
  • upgrade to webpack 4

0.1.54

3 years ago
  • fix page numbers for ToC with unbreakable content
  • updated fontkit to 1.8.0 for fix font problems
  • fix check for supported browsers
  • fix support file-saver on mobile devices
  • fix building pdfmake with pdf standard fonts

0.1.53

4 years ago

0.1.52

4 years ago
  • fix bug with creating links and set document info in client-side (in browser)

0.1.51

4 years ago
  • fix table fill color render with dontBreakRows

0.1.50

4 years ago
  • pdfkit updated to 0.9.0
  • fontkit updated to 1.7.8
  • Solved heavy use of memory
  • Supported PNG with alpha channel
  • Add encryption and access privileges, example of usage:
var docDefinition = {
    //userPassword: '123',
    ownerPassword: '123456',
    permissions: {
        printing: 'highResolution', //'lowResolution'
        modifying: false,
        copying: false,
        annotating: true,
        fillingForms: true,
        contentAccessibility: true,
        documentAssembly: true
    },
    content: [
        '...'
    ]
};

0.1.41

4 years ago
  • Table of Content: custom number style to toc item (tocNumberStyle)
  • browser: add getStream method for receive pdfkit document

Bugfixes:

  • ordered list: fix ignored properties start and count with value 0
  • removed setImmediate polyfill because is not allowed on sites with Content Security Policy (CSP)
  • fix redering fill color in table with borders

0.1.40

4 years ago
  • updated default Roboto font to latest version 2.137
  • updated file-saver to 2.0.0 and removed hacks for Web Worker
  • implemented text opacity
  • allow passing tableLayouts, fonts and vfs to createPdf instead of using global pdfMake. pdfMake.createPdf(docDefinition, tableLayouts, fonts, vfs) (see readme)

Bugfixes:

  • fixed text opacity after transparent image

0.1.39

4 years ago
  • implemented border style for table (see example)
  • implemented image opacity support (opacity property )
  • implemented ability to preserve trailing white space (preserveTrailingSpaces property)

Bugfixes:

  • fixed returing wrong y position after added repeatables
  • fixed fillOpacity changes for following images

0.1.38

4 years ago
  • added support for elements in text inlines for: pageReference, textReference, tocItem and property id (for pageReference, textReference and toc), see page reference example, ToC example and simple example:
    {
        text: [
            {text: 'some sample text '},
            {pageReference: ["element-id"]}
        ]
    }
    

    output is:

    some sample text 2
    

    (element with id "element-id" suppose in page 2)

Bugfixes:

  • fixed text decorations with justified text (#1418)
  • fixed calculating page height with option pageSize.height = 'auto'
  • throw nice error message when page reference id not found
  • fixed preprocessing text inlines
  • fixed text inlines wrapping with styles, eg. "remarkable" is now wrapped as one item (#975)
  • fixed printing repeatable headers for table in second column (#434)

0.1.37

4 years ago
  • new option bufferPages for pages buffering, example: var pdfKitDoc = printer.createPdfKitDocument(docDefinition, {bufferPages: true});
  • added second parameter to background function with page size
  • improved casting null and undefined
  • allows to register binary data in virtual file system

Bugfixes:

  • fix for multi-item backgrounds

0.1.36

4 years ago
  • fixed image Buffer conversion in static header/footer
  • fixed pdf open in js frameworks
  • updated to gulp 4
  • updated webpack

0.1.35

5 years ago
  • added pageReference and textReference for creating nice ToC (see examples)
  • added column index in table fillColor function - fillColor: function (rowIndex, node, columnIndex) { }

Bugfixes:

  • fixed background image overwrite fillColor on table

0.1.34

5 years ago
  • table row height feature (see examples)
  • lineCap support for vectors (butt, round, square) (see examples)
  • fontFeatures property for text (see examples) A specific feature must be suppored by font.
  • ToC - implemented link to page (on page number)
  • support for canvas alignment
  • removed using lodash dependency (pdfmake.js and pdfmake.min.js are smaller file sizes)

Bugfixes:

  • fixed setting compress property
  • fixed page break if is canvas with absolutePosition larger than page
  • fixed page break if is image or qr with absolutePosition out of page
  • fixed multiple tabs replacing

0.1.33

5 years ago
  • lists - own item type (listType):
{
  ul: [
    'item 1',
    {text: 'item 2', listType: 'none'},
    {text: 'item 3', listType: 'circle'}
  ]
}
  • support for nesting text elements:
{
  text: [
    { text: 'a better ' },
    { text: [{ text: 'some text ', bold: true}] },
    { text: 'independently' }
  ]
}
  • ToC - custom style:
toc: {
  title: {text: 'INDEX'},
  textMargin: [0, 0, 0, 0],
  textStyle: {italics: true},
  numberStyle: {bold: true}
}
{
  text: 'This is a header, using header style',
  style: 'header',
  tocItem: true,
  tocStyle: {bold: true},
  tocMargin: [0, 10, 0, 0]
},

0.1.32

5 years ago
  • add leading indent (use leadingIndent)
  • add preserving leading spaces (use preserveLeadingSpaces: true)
  • add unbreakable attribute to elements
  • updated pdfkit to 0.8.3
  • updated fontkit to 1.7.7

Bugfixes:

  • fix rendering after an empty list of columns

0.1.31

5 years ago
  • updated fontkit to 1.7.5

Bugfixes:

  • fix oversized images if they are the only item on a page
  • fix overlap footer with paddingBottom in table

0.1.30

5 years ago
  • updated fontkit to 1.7.2

Bugfixes:

  • fix pageBreakBefore error
  • fix colSpan error

0.1.29

5 years ago
  • improved performance significantly
  • updated pdfkit to 0.8.2
  • updated fontkit to 1.7.1 (add indic shaper)
  • simple table of contents (see examples)
  • colored QR codes (example: {qr: 'text', foreground: 'red', background: 'yellow'} )
  • support for "hard" wrapping non-wrappable long words

Bugfixes:

  • fixed colSpan line rendering bug in table header

0.1.28

5 years ago
  • new feature characterSpacing for text
  • added new optional parameter win to methods open() and print() for asynchronous operations (see readme)
  • new parameters minWidth, maxWidth, minHeight, maxHeight for image (#938)
  • supported setting own document metadata (see readme)
  • new feature linkToPage for text (see readme)

Bugfixes:

  • fix static header, footer for images
  • fix background color with justification
  • fix web worker compatibility (no hacks are needed)
    • Attention! You need regenerate file vfs_fonts.js for full support.

0.1.27

5 years ago
  • improved performance (partly)
  • new fontkit version 1.5.4
  • removed webpack hacks for fontkit

0.1.26

5 years ago
  • improved unordered and ordered lists
    • colored lists (color, markerColor)
    • type of unordered list: disc (default), circle, square, none
    • type of ordered list: decimal (default), upper-alpha, lower-alpha, upper-roman, lower-roman, none
    • add atributes for ordered list - separator, start, reversed
    • see examples
  • add progress callback option (#851)
  • add getBlob method to browser version
  • update to webpack 2

Bugfixes:

  • fix calculation auto page height
  • fix noWrap
  • fix calculate width in text page with other pageOrientation
  • fix wrong page orientation in first page

Note: This version contains in webpack temporary bugfixies for fontkit 1.5.2 issues: https://github.com/devongovett/fontkit/issues/65, https://github.com/devongovett/fontkit/issues/66


0.1.25

6 years ago
  • support for auto height page (pageSize.height = 'auto')
  • table layout: added fillColor function (eg. fillColor: function (i, node) { return 'red'; }), see examples
  • virtual file system: added throw error if file not found
  • added check for window blocked
  • rewrited performance hack (stream.read(9007199254740991)) to core pdfmake

Bugfixes:

  • fixed compatibility with fontkit version 1.5.2
  • fix noWrap
  • fix calculate width in text page with other pageOrientation
  • added linebreak package as dependency (package.json)

Note: This version contains in webpack temporary bugfixies for fontkit 1.5.2 issues: https://github.com/devongovett/fontkit/issues/65, https://github.com/devongovett/fontkit/issues/66


0.1.24

6 years ago
  • grunt removed
  • new fontkit version 1.5.2
  • support for TrueType Collection (.ttc) (#801)
  • update Roboto font to latest version
  • add bold+italics Roboto font type
    var defaultClientFonts = {
        Roboto: {
            normal: 'Roboto-Regular.ttf',
            bold: 'Roboto-Medium.ttf',
            italics: 'Roboto-Italic.ttf',
            bolditalics: 'Roboto-MediumItalic.ttf'
        }
    };

Bugfixes:

  • fixed compatibility with fontkit version 1.5.2
  • improved fix for embeded exception
  • remove unwanted sourceMappingURL in build file

Note: This version contains in webpack temporary bugfix for fontkit 1.5.2 issue: https://github.com/devongovett/fontkit/issues/65


0.1.23

6 years ago

Features:

  • the Unicode Line Breaking Algorithm (UAX #14) is used for splitting words (supports also Chinese)
  • support link for images
  • linear gradient for rect (#792)
  • relative positioning (#793)
  • can set maximum number of pages to render (#797)
  • text formatted number is cast to string (similarly for boolean and null)
  • optimize performance in normalize document definition

Bugfixes:

  • fixed embeded exception
  • fixed margin reset after page break
  • fixed links support
  • fixed drawing text to baseline
  • fixed QR code generated is mirror and rotated 90 degrees
  • don't add up the QR code horizontal offset

0.1.22

6 years ago

Features:

  • update to PDFKit v0.8.0 with fontkit (support otf and woff font formats)
  • update all dependencies and uplift code to work with latest package versions
  • added yarn support
  • allow to specify CreationDate property
  • compression is enabled by default. Can be disabled by compress: false
  • watermark formatting/styling
  • border for table cells
  • gulp: added the ability to create virtual file system for fonts. Command: gulp buildFonts
  • added parameter pageSize to header function

Bugfixes:

  • fixed print and open for large files
  • fixed links support
  • fixed building on Windows
  • don't add up the images horizontal offset
  • catch malformed table row error
  • validate text before replacing
  • fixed tables bug with header border lines on new pages being repeated several times
  • fixed check of browser support, no more being annoyed while building too
  • update FileSaver.js submodule to latest master, this should fix problems with using pdfmake on iOS devices
  • fixed a problem with the performance for large documents
  • and other fixes...
Watermark formatting

example with own format:

var docDefinition = {

...
    watermark: {text: 'test watermark', color: 'blue', opacity: 0.3, font: 'Courier', bold: true, italics: true},
...

};

example without formatting:

watermark: 'test watermark'
Border for table cells

example of table cell:

{
    //      (left border, top border, right border, bottom border)
    border: [false, true, false, false],
    text: 'text in table cell'
}
New parameter pageSize in header function
var docDefinition = {
  footer: function(currentPage, pageCount) { return currentPage.toString() + ' of ' + pageCount; },
  header: function(currentPage, pageCount, pageSize) {
    // you can apply any logic and return any valid pdfmake element

    return [
      { text: 'simple text', alignment: (currentPage % 2) ? 'left' : 'right' },
      { canvas: [ { type: 'rect', x: 170, y: 32, w: pageSize.width - 170, h: 40 } ] }
    ]
  },
  (...)
};

0.1.18

7 years ago

0.1.17

7 years ago

Features:

  • Introduce new styling properties marginLeft, marginRight, marginTop, and marginBottom.
  • Add the capability to have switch of page orientation per page.
  • Adds an editorconfig.
  • Adding possibility to specify line height.
  • Access to internal pages array, to have better testing capabilities.
  • Dynamically control page breaks, for instance to avoid orphan childs.

Bug Fixes:

  • Add the type to the font name for pdfkit. This is to avoid using the same type (normal, bold, italics, bolditalics) every time a font is requested. Fixes #162.
  • Use function for vLineColor if provided on table layout. Fixes #166.
Introduce new styling properties marginLeft, marginRight, marginTop, and marginBottom.

An element in the document definition can now specify margin on any side individually. This allows to combine margins from different styles.

 {
  content: [
    {text: 'text with style 1', style: ['style1']},
    {text: 'text with style 2', style: ['style2']},
    {text: 'text with both styles', style: ['style1', 'style2']}
  ], 
  styles: {
   style1: {
       marginTop: 30
   }, 
   style2: {
       marginLeft: 20
    }
  }
}
Add the capability to have switch of page orientation per page.

This allows a document to switch between landscape and portrait in a document.

    {
      pageOrientation: 'portrait',
      content: [
        {text: 'Text on Portrait'},
        {text: 'Text on Landscape', pageOrientation: 'landscape', pageBreak: 'before'},
        {text: 'Text on Landscape 2', pageOrientation: 'portrait', pageBreak: 'after'},
        {text: 'Text on Portrait 2'},
      ]
    }

Important you need to specify a page break on the same node, to make sure the page can switch it's orientation.

Adds an editorconfig.

An .editorconfig file makes sure that coding conventions, especially whitespaces, are kept within each editor.

Adding possibility to specify line height.

A new style property lineHeight is now available.

    {
      content: [{text: 'this is a very long text', lineHeight: 1.5}]
    }

lineHeight is a relative value.

Access to internal pages array, to have better testing capabilities.

This allows writing integration test agains a array of pages in PDF Make.

pdfMake.createPdf(docDefinition)._getPages({}, function(pages){
  assert.equal(pages.length, 2);
});
Dynamically control page breaks, for instance to avoid orphan childs.

You can now specify a pageBreakBefore function, which can determine if a page break should be inserted before the page break. To implement a 'no orphan child' rule, this could like like this:

var dd = {
    content: [
       {text: '1 Headline', headlineLevel: 1},
       'Some long text of variable length ...',
       {text: '2 Headline', headlineLevel: 1},
       'Some long text of variable length ...',
       {text: '3 Headline', headlineLevel: 1},
       'Some long text of variable length ...',
    ],
  pageBreakBefore: function(currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
     return currentNode.headlineLevel === 1 && followingNodesOnPage.length === 0;
  }
}

If pageBreakBefore returns true, a page break will be added before the currentNode. Current node has the following information attached:

{
   id: '<as specified in doc definition>', 
   headlineLevel: '<as specified in doc definition>',
   text: '<as specified in doc definition>', 
   ul: '<as specified in doc definition>', 
   ol: '<as specified in doc definition>', 
   table: '<as specified in doc definition>', 
   image: '<as specified in doc definition>', 
   qr: '<as specified in doc definition>', 
   canvas: '<as specified in doc definition>', 
   columns: '<as specified in doc definition>', 
   style: '<as specified in doc definition>', 
   pageOrientation '<as specified in doc definition>',
   pageNumbers: [2, 3], // The pages this element is visible on (e.g. multi-line text could be on more than one page)
   pages: 6, // the total number of pages of this document
   stack: false, // if this is an element which encapsulates multiple sub-objects
   startPosition: {
     pageNumber: 2, // the page this node starts on
     pageOrientation: 'landscape', // the orientation of this page
     left: 60, // the left position
     right: 60, // the right position
     verticalRatio: 0.2, // the ratio of space used vertically in this document (excluding margins)
     horizontalRatio: 0.0  // the ratio of space used horizontally in this document (excluding margins)
   }
}

0.1.14

8 years ago

0.1.13

8 years ago
  • fixes issues related to images not being rendered,
  • upgrades pdfkit to 0.7.0

0.1.11

8 years ago

Roboto fonts upgraded to the newest version (should fix printing issues with some printers)

vfs_fonts is now ~560 kB instead of 862kB - Roboto-Light was removed from vfs_fonts.js, as it hadn't been used


0.1.10

8 years ago

minified version is working now

bugs in tables (and double border) have been fixed


0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.41

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

77 Versions

TagPublished
0.3.0-beta.2beta5mos ago
0.2.5latest5mos ago
0.3.0-beta.18mos ago
0.2.49mos ago
0.2.39mos ago
0.2.21yr ago
0.2.11yr ago
0.2.01yr ago
0.1.721yr ago
0.1.711yr ago
0.1.702yrs ago
0.1.692yrs ago
0.1.682yrs ago
0.1.672yrs ago
0.1.662yrs ago
0.1.652yrs ago
0.1.643yrs ago
0.1.633yrs ago
0.1.623yrs ago
0.1.613yrs ago
0.1.603yrs ago
0.1.593yrs ago
0.1.583yrs ago
0.1.573yrs ago
0.1.563yrs ago
0.1.553yrs ago
0.1.543yrs ago
0.1.534yrs ago
0.1.524yrs ago
0.1.514yrs ago
0.1.504yrs ago
0.1.414yrs ago
0.1.404yrs ago
0.1.394yrs ago
0.1.384yrs ago
0.1.374yrs ago
0.1.364yrs ago
0.1.355yrs ago
0.1.345yrs ago
0.1.335yrs ago
0.1.325yrs ago
0.1.315yrs ago
0.1.305yrs ago
0.1.295yrs ago
0.1.285yrs ago
0.1.275yrs ago
0.1.265yrs ago
0.1.256yrs ago
0.1.246yrs ago
0.1.236yrs ago
0.1.226yrs ago
0.1.187yrs ago
0.1.177yrs ago
0.1.148yrs ago
0.1.138yrs ago
0.1.118yrs ago
0.1.108yrs ago
0.1.88yrs ago
0.1.78yrs ago
0.1.68yrs ago
0.1.58yrs ago
0.1.48yrs ago
0.1.38yrs ago
0.1.28yrs ago
0.0.128yrs ago
0.0.118yrs ago
0.0.108yrs ago
0.0.98yrs ago
0.0.88yrs ago
0.0.78yrs ago
0.0.68yrs ago
0.0.58yrs ago
0.0.418yrs ago
0.0.48yrs ago
0.0.38yrs ago
0.0.28yrs ago
0.0.18yrs ago