marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.55k stars 544 forks source link

How to set margin top on all pages? #675

Open golubvladimir opened 2 years ago

golubvladimir commented 2 years ago

I created project - https://github.com/golubvladimir/nestjs-generate-pdf

I want to create document with same header on all pages. I created header by element with id pageHeader. After I set height to 1px in options.

header: {
    height: '1px'
}

I don't know, how to set margin for all pages from header. Now it works only on first page.

golubvladimir commented 2 years ago

I have this problem only on Windows.

matthew-boston commented 1 year ago

I don't think you can set margins explicitly. However, if you apply a margin to the body like so:

body{
  margin: 30px;
}

This will apply a 30px margin around the content inside the document.

DaraSingh1998 commented 1 year ago

It only adds the top margin on 1st page. How to do this at all page