wkhtmltoimage CSS3 gradient rendering in Snapshots

前端 未结 2 1600
清酒与你
清酒与你 2021-01-05 22:22

I am using wkhtmltoimage to render a snapshot for my website which contains a background gradient but it doesn\'t show up in the generated snapshot.

I tried using on

相关标签:
2条回答
  • 2021-01-05 22:59

    Did you check your gradient syntax. wkhtmltopdf uses the webkit syntax.

      background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,rgb(64,128,176)),color-stop(100%,rgb(1,73,129)));
      background:linear-gradient(to bottom,rgb(64,128,176) 0%,rgb(1,73,129) 100%);
    

    The second syntax will not count to wkhtmltopdf but the first one works for the version of wkhtmltopdf I have (0.10.0 rc2).

    I also found that modern webkit syntax doesn't work. i.e. this didn't work

    background: -webkit-linear-gradient(top, #ccc 0%, #888 100%);
    

    As per this : stackoverflow entry

    0 讨论(0)
  • 2021-01-05 23:22

    As as 0.12.2.1 of wkhtmltopdf the gradient css - either old or new doesn't work.

    0 讨论(0)
提交回复
热议问题