Whetmltopdf stylesheets

can someone tell me how to enable custom style ind wkhtlmtopdf v. 0.10?

I refer to a local file, but this has no effect on my Pdf.

switches += "--user-style-sheet \User\...\style.css " 
+6
source share
3 answers

How about using the "real" URL syntax with your switch? Sort of

 switches += "--user-style-sheet file:///User/.../style.css" 
+4
source

Another option for using the argument is to enter the stylesheet programmatically before the PDF conversion occurs. Perhaps using a URL parameter that determines whether the page is loaded into wkhtmltopdf or the page is loaded by pasting a CSS link and then tearing down the page for wkhtmltopdf.

+1
source

In terminal

 wkhtmltopdf -V wkhtmltopdf 0.12.2.4 

Command

  wkhtmltopdf --user-style-sheet yourcssfile.css yourhtmlfile.html outputfile.pdf 
0
source

Source: https://habr.com/ru/post/914111/


All Articles