pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

Table row does not start from new page

Open Tawsif opened this issue 10 years ago • 6 comments

Hello,

We are trying to generate a PDF using PDFMAKE. For PDF generation, we are utilizing Table, Text and Images.

But it seems that Table is not able to understand the Text alignment along with the Image. If the Cell is not able to contain the Image on the same page, it automatically applies Page Break for it. So that the Image is not sliced and it appears properly on the next page. That is fine.

But the text remains on the same page. And hence it looks very weird. Text on same page and Image on another. Please find the attached Image where we have showed the issue. Its a screenshot of the PDF generated by us.

Do we have any work around for the same. We also want the text to appear along with the Image so that the alignment looks fine. Please help us out for the same. Thanks in Advance.

Have a look at below screenshot for reference-

table_spacing-error

Tawsif avatar Aug 11 '15 10:08 Tawsif

This is a problem for me as well.

surjikal avatar Aug 20 '15 19:08 surjikal

Same for me

no-more avatar Oct 23 '15 12:10 no-more

Was there a fix for this? :)

playingwithbandits avatar Jul 01 '16 11:07 playingwithbandits

table: {
    headerRows: 1,
    widths: ['auto', 'auto', 'auto', 'auto']
    dontBreakRows:true,
    body: [ someBody ]
}

setting dontBreakRows:true in table declaration helped me

vytautassugintas avatar Jul 15 '16 11:07 vytautassugintas

Thanks!

playingwithbandits avatar Jul 15 '16 11:07 playingwithbandits

Code for reproduce issue:

var dd = {
    pageSize: 'A7',
    pageOrientation: 'landscape',
	content: [
		{
			table: {
				body: [
					['Column 1', 'Column 2', 'Column 3'],
					['Column 1', 'Column 2', 'Column 3'],
					['Column 1', 'Column 2', {image: 'sampleImage.jpg', width: 130}],
				]
			}
		},
	]	
}

liborm85 avatar Aug 30 '18 10:08 liborm85