1
  1. I'm generating an html file using HTMLService
    1. Then I create a file out of the htmlOutput with the DriveService
    2. Last I generate a pdf file with the blob.GetAs("application/pdf")

This works all fine, but the background colors don't get printed. Is there a way to bring the background color html styles in the pdf ?

fredsol
  • 11
  • 1

2 Answers2

1

Had the same issue! Add this to a style-tag in you html file.

@media print {body {-webkit-print-color-adjust: exact;}}

For me that resolved the issue. (found it here)

Jasper Cuvelier
  • 388
  • 4
  • 13
0

You could try using a different data flow to get your pdf as described in this post answer and in this other one.

I didn't test with colored backgrounds but it is worth giving it a try.

Community
  • 1
  • 1
Serge insas
  • 44,113
  • 6
  • 95
  • 123