Skip to content

Releases: bpampuch/pdfmake

0.1.30

01 Jun 17:41
Compare
Choose a tag to compare
  • updated fontkit to 1.7.2

Bugfixes:

  • fix pageBreakBefore error
  • fix colSpan error

0.1.29

30 May 17:38
Compare
Choose a tag to compare
  • 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

29 Apr 09:17
Compare
Choose a tag to compare
  • 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

25 Mar 09:47
Compare
Choose a tag to compare
  • improved performance (partly)
  • new fontkit version 1.5.4
  • removed webpack hacks for fontkit

0.1.26

26 Feb 13:10
Compare
Choose a tag to compare
  • 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: foliojs/fontkit#65, foliojs/fontkit#66

0.1.25

29 Jan 09:57
Compare
Choose a tag to compare
  • 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: foliojs/fontkit#65, foliojs/fontkit#66

0.1.24

08 Jan 12:09
Compare
Choose a tag to compare
  • 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: foliojs/fontkit#65

0.1.23

29 Dec 07:13
Compare
Choose a tag to compare

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

23 Dec 06:42
Compare
Choose a tag to compare

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.17

03 Mar 02:53
Compare
Choose a tag to compare

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)
   }
}