Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to stretch the table height in pdfmake? #561

Closed
athimannil opened this issue Apr 17, 2016 · 3 comments
Closed

How to stretch the table height in pdfmake? #561

athimannil opened this issue Apr 17, 2016 · 3 comments

Comments

@athimannil
Copy link

Is there any option in pdfmake to fill the table in entire page ?

Demo: https://jsfiddle.net/t2dbcb4t/

0aurt

Here is the current version of pdfmake

var docDefinition = {
  pageMargins: [0, 0, 30, 0],
  content: [{
    table: {
      widths: ['20%', '80%'],
      body: [
        [{
            fillColor: '#ebebeb',
            color: '#000',
            text: 'first column',
          },
          [{
            fontSize: 24,
            fillColor: '#fff',
            text: 'My name'
          }, {
            margin: [-5, 0, 0, 0],
            table: {
              widths: ['120'],
              body: [
                [{
                  fontSize: 11,
                  bold: true,
                  fillColor: '#ebebeb',
                  margin: [15, 3, 0, 3],
                  text: 'PROFILE'
                }]
              ]
            },
            layout: 'noBorders'
          }, {
            text: [
              'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque aliquid, possimus officiis. Est, cum. Rem hic quisquam laborum ex quae nemo. Optio quam ad eaque obcaecati repellat pariatur nobis blanditiis. ipsum dolor sit amet, consectetur adipisicing elit. In explicabo, velit dolorum sint. Error ea cum voluptatem quisquam, doloribus doloremque, maiores pariatur totam tempora cumque quo eos sint. Libero, aut! \n\n',
              'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat cumque unde quam ullam nostrum maxime laborum, labore aperiam? Neque, totam itaque recusandae excepturi explicabo sunt et culpa dolorem ea soluta! ipsum dolor sit amet, consectetur adipisicing elit. Assumenda dolorem totam iure quod ipsam in harum. Pariatur exercitationem quas maiores facilis labore ab, repudiandae voluptatum quia, delectus quidem debitis dolores! \n'
            ],
            style: ['summaryStyle']
          }]
        ]
      ]
    },
    layout: 'noBorders'
  }],
  styles: {
    summaryStyle: {
      fontSize: 10,
      alignment: 'justify',
      margin: [10, 10, 0, 10],
    },
    titleStyle: {
      bold: true,
      margin: [0, 0, 0, -2]
    },
    experienceStyle: {
      margin: [0, 0, 0, 10]
    }
  },
  defaultStyle: {
    color: '#000'
  }
};
pdfMake.createPdf(docDefinition).download();
@jww2000
Copy link

jww2000 commented Apr 17, 2016

I could not find a way either so I put my content in a function above dd and called it so you can put in blank rows, I know this isnt ideal, but it worked for me

touchaqb pushed a commit to touchhealth/pdfmake that referenced this issue Jan 31, 2017
…ght as well as width (bpampuch#264, bpampuch#204, bpampuch#561, bpampuch#511, bpampuch#505, bpampuch#391).

Conflicts:
	build/pdfmake.js
	build/pdfmake.min.js
	build/pdfmake.min.js.map
	src/documentContext.js
	src/layoutBuilder.js
	src/pageElementWriter.js
	src/printer.js
touchaqb pushed a commit to touchhealth/pdfmake that referenced this issue Feb 13, 2017
…ght as well as width (bpampuch#264, bpampuch#204, bpampuch#561, bpampuch#511, bpampuch#505, bpampuch#391).

Conflicts:
	build/pdfmake.js
	build/pdfmake.min.js
	build/pdfmake.min.js.map
	src/documentContext.js
	src/layoutBuilder.js
	src/pageElementWriter.js
	src/printer.js
@liborm85
Copy link
Collaborator

duplicate: #391

@CanadaViet
Copy link

CanadaViet commented Oct 15, 2020

Add that to your table layout. You will add a padding for your last row. not perfect, but it's working
layout: {
paddingBottom: function (i, node) {
if (i === bodyOfTheTable.length - 1) {
return 600 - node.positions[node.positions.length-1].top;
}
else {
return 0;
}
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants