0

I´m not sure if this extremely simple or imposible and I´ll try to explain it in the best way possible.

I have a php file that uses the Dompdf library to give the user a pdf file so he/she can print it. The information in the file is always different so the lenght is also always different.

When dompdf renders my html and displays the pdf file, everything is fine (style, margins, colors, everything) but when the html ends, the remaining space is filled with gray. So at the end, it looks like a big box(or litlle, depending on how much information) in gray in the last page of my pdf.

Does anyone knows how to change that color? All that I want to do is change that gray color to white.

Thanks in advance.

j08691
  • 204,283
  • 31
  • 260
  • 272
Kenny Barrera
  • 172
  • 2
  • 14
  • do you send the output as formatted html including hard-coded css in the head part ? – OldPadawan May 04 '17 at 18:15
  • Sorry @OldPadawan, I´m not that familiar with english expresions, but with that you mean if I override the regular css style with my own? In that case, yes, I did. – Kenny Barrera May 04 '17 at 18:18
  • do you set body height to 100% with the desired color ? – OldPadawan May 04 '17 at 18:20
  • Yep, I did. Maybe if I explain it better it will help you. All CSS is working perfectly. When all html and css code ends, there is a portion of the page (the actual page of the pdf not the webpage) that do not contains any html or css so I guess dompdf understands that as empty space and fills it with a gray color. All I want is change that color to white. – Kenny Barrera May 04 '17 at 19:04
  • no, your explanation was clear enough, don't worry about that :) It just happened to me the same way, I created a `div` container and put all html stuff inside, div with 100% height, I thought this could do it for you – OldPadawan May 04 '17 at 19:07
  • Hey thanks for the suggestion. It somehow works. I think I can figure it out from here. I appreciate your answer a lot. – Kenny Barrera May 04 '17 at 21:05
  • Glad it helped ! I'll add it as an answer then, and you can close the question then :) happy coding ! – OldPadawan May 04 '17 at 21:09

1 Answers1

0

You can add a div wrapping all of the html stuff inside, and set its height to 100%.

OldPadawan
  • 1,247
  • 3
  • 16
  • 25