Releases: bpampuch/pdfmake
0.1.28
- new feature
characterSpacing
fortext
- added new optional parameter
win
to methodsopen()
andprint()
for asynchronous operations (see readme) - new parameters
minWidth
,maxWidth
,minHeight
,maxHeight
forimage
(#938) - supported setting own document metadata (see readme)
- new feature
linkToPage
fortext
(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.
- Attention! You need regenerate file
0.1.27
0.1.26
- 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
- colored lists (
- 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
- 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
- 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'
}
};
- support
tableLayouts
in browser, see: https://github.com/bpampuch/pdfmake#own-table-layouts - improved casting to string for non-text elements
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
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
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
toheader
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
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)
}
}