Closed SamirMishra27 closed 3 months ago
This is logical behavior, because table has no text, but lot of cells with text. tocItem must be placed in text of a cell, example:
var dd = {
content: [
{
toc: {
id: 'table-of-contents',
title: {
text: 'Table of Contents',
alignment: 'center',
style: 'header',
fontSize: 18,
color: '#008080',
bold: true,
marginBottom: 10
},
}
},
{
style: 'tableExample',
table: {
body: [
[{text:'Column 1', tocItem: 'table-of-contents'}, 'Column 2', 'Column 3'],
['One value goes here', 'Another one here', 'OK?']
]
}
},
]
}
Thank you for your reply! I didn't know doing this was possible.
Description:
If I try to add
tocItem
to a table block, it won't be referenced in the table of contents section.Steps to recreate
Run this minimal example in pdfmake playground.
Node.js version v20.11.0 pdfmake version v0.2.9