Willy
Willy

Reputation: 1838

SVG ClipPath does not work with wkhtmltopdf

Recently I created a chart which is similar with the one in ny times. It works well. And I tried to export the page to pdf by wkhtmltopdf. I found if the svg with clipPath is generated by JS in runtime. I can successfully export the pdf. enter image description here However if the svg with clipPath is initially in the html(I copied the html texts from the previous one). The clipPath part does not work anymore(like attachment). I am guessing it is related to absolute path with clip-path. But is still with no luck. Any suggestion for my next step?

Below is related svg from my example which can be viewed in browser but does not work with wkhtmltopdf.(Have reference from NY times ) Local file

enter image description here

Upvotes: 3

Views: 1427

Answers (1)

ychi chen
ychi chen

Reputation: 286

You can refer to SVG defs element, which the NYTimes page did not use.

By putting clipPaths inside defs element, wkhtmltopdf can export the chart successfully.

Upvotes: 5

Related Questions