Forum: Ruby on Rails How to use same css in pdf for wkhtmltopdf

Posted by keerthi priya (Guest)
on 2013-02-25 11:31
(Received via mailing list)
hi I am not getting the css in my pdf i wanna use same css for my pdf 
also
rather going for new css for pdf. how can I use same css which I use in 
my
views. I am using wkhtmltopdf for pdf generation and one more thing is 
how
get page page brake using wkhtmltopdf.




Cheers,
Kp
Posted by masta Blasta (mastablasta)
on 2013-02-25 18:28
keerthi priya wrote in post #1098932:
> hi I am not getting the css in my pdf i wanna use same css for my pdf
> also
> rather going for new css for pdf. how can I use same css which I use in
> my
> views. I am using wkhtmltopdf for pdf generation and one more thing is
> how
> get page page brake using wkhtmltopdf.
>
>
>
>
> Cheers,
> Kp

Start here

https://github.com/mileszs/wicked_pdf
Posted by Derek M (Guest)
on 2013-02-25 21:14
(Received via mailing list)
I believe wkhtmltopdf will pick up links to stylesheets in your HTML,
however, they need to be absolute paths, not relative. You could hack it
and pull your HTML, then your CSS, and embed the CSS directly into the 
head
of the HTML. This is probably not the best practice though.
Posted by Derek M (Guest)
on 2013-02-25 21:15
(Received via mailing list)
I believe wkhtmltopdf will pick up links to stylesheets in your HTML,
however, they need to be absolute paths, not relative. You could hack it
and pull your HTML, then your CSS, and embed the CSS directly into the 
head
of the HTML. This is probably not the best practice though. Also, to get 
a
page-break, use the CSS rule page-break-before or page-break-after and 
make
sure you are running a build of wkhtmltopdf that is built against the
patched QT.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.