pdfjs
pdfjs copied to clipboard
Rendering issues with non-nested tables
Hi,
I have some render issues with tables and page breaks. There are some related issues (https://github.com/rkusa/pdfjs/issues/191 and https://github.com/rkusa/pdfjs/issues/203), but they all seem to concern nested tables, which is not the case here.
You can recreate the issue with following example:
const pdf = require('pdfjs')
const doc = new pdf.Document({
font: require('pdfjs/font/Helvetica'),
fontSize: 12
})
/// Fill first page (but not completely) to enforce page break:
for (let i = 0; i < 50; i++) doc.cell().text(`line ${i + 1}`)
// Create table with two columns and two rows:
const table = doc.cell().table({
widths: [null, null],
borderWidth: 1
})
const row = table.row()
row.cell().text('ONE')
row.cell().text('TWO')
const row2 = table.row()
row2.cell().text('THREE')
row2.cell().text('FOUR')
The table is rendered on page 2 (as it should), but the cell "FOUR" is moved to the top of the page, overlapping cell "TWO" (see document.pdf).
Is this a problem you are already aware of?