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

Cover page? #1086

Closed
stevemeisner opened this issue Jul 27, 2017 · 3 comments
Closed

Cover page? #1086

stevemeisner opened this issue Jul 27, 2017 · 3 comments

Comments

@stevemeisner
Copy link

I wasn't sure if this was a good place to reach out about a feature - I hope it's ok.

It would be nice to be able to define a "cover page" that happens only once, and and any defined repeating headers or footers start after that if it exists.

This may be currently possible, and I just have not sorted it out yet.

Thanks - incredible work!

@davidvictor
Copy link

you can do something like this to not render the header or footer on the first page.

const header = function (currentPage, pageCount) {
  if (currentPage != 1) {
    return {
      columns: [
        {
          text: 'Employee Handbook',
          style: ['vsmall', 'gray'],
          margin: [40, 26, 0, 0]
        }, {
          image: 'companyLogo',
          width: w,
          alignment: 'center',
          margin: [0, 18, 0, 0]
        }, {
          text: `${user.company.name}`,
          alignment: 'right',
          style: ['vsmall', 'gray'],
          margin: [0, 26, 40, 0]
        }
      ],
    }
  }
  else {
    return {}
  }
};

@liborm85
Copy link
Collaborator

liborm85 commented Dec 3, 2017

Answered.

Connected with #368, #283, #147.

@liborm85 liborm85 closed this as completed Dec 3, 2017
@reworx-ux
Copy link

reworx-ux commented Dec 15, 2019

Where exactly should I insert this. Pasting it right after const documentDefinition = this.getDocumentDefinition(); doesn't work. The header gets ignored in the PDF.

Pasting it after getDocumentDefinition() {return {pageSize: 'A4'pageMargins: [ 50, 80, 40, 100 ]} looks like the code below, but I get ERROR: Type Error Cannot read property 'offer' of undefined:

header: function(currentPage, pageCount) {
if (currentPage != 1) {
return {
columns: [
{
text: 'Employee Handbook',
style: ['vsmall', 'gray'],
margin: [40, 26, 0, 0]
}, {
image: 'companyLogo',
width: '100',
alignment: 'center',
margin: [0, 18, 0, 0]
}, {
text: this.offer.place.address.street,
alignment: 'right',
style: ['vsmall', 'gray'],
margin: [0, 26, 40, 0]
}
],
}
}
else {
return {}

    }

  
  },

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