Open emiliepoccioli opened 10 years ago
Hi,
I had the same problem but it seems that it is not a bug. In fact the css are loaded in WkHtmlToPdf not with Pechkin so virtual path are wrong. You need to specify a complete Url or Uri.
With absolute Uri, it works for me !
Thanks for your answer. I managed to make it work in a different way! Thanks
@emiliepoccioli How did you managed to make it work?
@emiliepoccioli How did you managed to make it work?
I got it working by reading my entire stylesheet into a string and then appending that to the HTML which gets fed into pechkin. Worked a treat!
string cssPath = Server.MapPath("~/Content/Site.css"); string cssString = `File.ReadAllText(cssPath); HTML = "" + HTML;
This pattern is not resolving in view when complete html is passed to pechkin when working with https:
protocal. With http:
all works fine.
@Styles.Render(Url.AbsoluteUrl("Content/themes/base/css"))
@Styles.Render(Url.AbsoluteUrl("Content/themes/css"))
@Scripts.Render(Url.AbsoluteUrl("Scripts/library"))
@Scripts.Render(Url.AbsoluteUrl("Scripts/Common"))
Hi, My HTML files use external CSS links such as : (My application uses MVC 5) I am struggling to get the CSS intepreted in the PDF as it seems to not recognize the path. On the C# side I added SetUserStylesheetUri(cssPath) that doesn't seem to do anything Here is the code on the C# side: public void GeneratePDF(string htmlContent) {
So, Can we generate PDF with external CSS links? I tried adding directly the CSS on my HTML pages to test if it works, and it did. But I can't put the entire CSS on my HTML pages If so, how can I do it with external stylesheets?
Thanks for your help!