Node-html-pdf: How can I add a background page?

Created on 24 May 2016  路  3Comments  路  Source: marcbachmann/node-html-pdf

I need add one background for all pages like:

How can I do that?

Most helpful comment

Likely solution at my question:

#pageHeader:after, 
.pageHeader:after {
  content: "";
  display: block;
  position:fixed;
  bottom:0;
  right:0;
  top:0;
  left:0;
  height: 842px;
  //- width: 595px;
  width: 100%;
  opacity: 0.5;
  background-image: url("background.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: contain;
}

This works for me, probably it will help others who have the same problem.

All 3 comments

Likely solution at my question:

#pageHeader:after, 
.pageHeader:after {
  content: "";
  display: block;
  position:fixed;
  bottom:0;
  right:0;
  top:0;
  left:0;
  height: 842px;
  //- width: 595px;
  width: 100%;
  opacity: 0.5;
  background-image: url("background.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: contain;
}

This works for me, probably it will help others who have the same problem.

Thanks for this solution. It almost fixed my problem. Though above solution requires the header to be present (at least 1 pixel). Which shows a white row when using full page backgrounds. Any idea how to fix this?

Thanks to @RodolfoSilva for the solution, now I'm able to set a background image on all pages, but how do you manage the margins on page breaks? If I configure a border like this:
let options = { "format": "A4", "header": { "height": "1mm", }, "border": { "top": "2cm", "right": "0px", "bottom": "2cm", "left": "0px" }, };
then my background image also goes 2cm down...
Any idea?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

B-StS picture B-StS  路  5Comments

ascsi picture ascsi  路  3Comments

cmoulliard picture cmoulliard  路  3Comments

antiframes picture antiframes  路  4Comments

Messilimeng picture Messilimeng  路  4Comments