wkhtmltopdf stylesheets
Asked Answered
B

3

9

can anybody tell me how to include user-style-sheet ind wkhtlmtopdf v. 0.10?

I'm refering to a local file, but that doesn't effect my Pdf anyway.

switches += "--user-style-sheet \User\...\style.css "
Bilbo answered 25/4, 2012 at 9:50 Comment(2)
Is it an option for you to use another utility than wkhtmltopdf? One that has better support for using stylesheets?Sporophyll
No, our application is nearly finished with wkhtml.Bilbo
S
5

What about using a 'real' URL syntax with your switch? Something like

switches += "--user-style-sheet file:///User/.../style.css"
Sporophyll answered 26/4, 2012 at 13:55 Comment(2)
Just a note: you cannot specify multiple CSS files this way.Abirritant
how to specify a single file.css with the linux terminal wkhtmltopdf h.html h.css outpu.pdf how to do thisVoroshilov
Q
4

Another option to using the argument is to inject the stylesheet programmatically before the PDF conversion happens. Perhaps by using a URL parameter that identifies if a page is being fed to wkhtmltopdf or by downloading the page, injecting the CSS reference and then regurgitating the page for wkhtmltopdf.

Quag answered 12/7, 2012 at 7:41 Comment(0)
V
4

In terminal

wkhtmltopdf -V
wkhtmltopdf 0.12.2.4

Command

 wkhtmltopdf --user-style-sheet yourcssfile.css yourhtmlfile.html outputfile.pdf
Voroshilov answered 8/2, 2018 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.