pdfmake
pdfmake copied to clipboard
Inherited styles
It would be helpful to be able to base styles on other styles. I am not sure how difficult this would be.
For example:
var dd = {
content: [
{
text: 'This is a header, using header style',
style: 'header'
},
'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Confectum ponit legam, perferendis nomine miserum, animi. Moveat nesciunt triari naturam.\n\n',
{
text: 'Subheader 1 - using subheader style',
style: 'subheader'
},
'Subheader above would appear bold!'
],
styles: {
header: {
fontSize: 18,
bold: true
},
subheader: {
fontSize: 15,
style: 'header'
}
}
}
Implemented by commit https://github.com/bpampuch/pdfmake/commit/79c8e0b5cd8a935b458691e94d09cc4a440b6e9e new extends property for style.
Simple example:
var dd = {
content: [
{
text: 'This is a header, using header style',
style: 'header'
},
{
text: 'Subheader 1 - using subheader style',
style: 'subheader'
}
],
styles: {
header: {
fontSize: 18,
bold: true
},
subheader: {
fontSize: 15,
extends: 'header' // or array of strings
},
}
};
Feature released in version 0.3.3.