1

Good day

I'm trying to use wkhtmltoimage (part of wkhtmltopdf) to generate screenshot of websites. I'm trying to use css with some websites, but cant manage to figure out what is wrong

I've looked in the previous posts and I've generated the following base64 for Tahmoa font

@font-face {
    font-family: 'Tahoma';
    src: url(data:font/truetype;charset=utf-8;base64,AAEA..[LONG STRING]..AA=) format('truetype');
}

I have the following css file where I use it in my css file.

This is test.css file (where I'm doing something wrong?)

@font-face {
     font-family: 'Tahoma';
     src: url(data:font/truetype;charset=utf-8;base64,AAEA..[LONG STRING]..AA=) format('truetype');
}
h2{
   font-family:'Tahoma'
   background-color:red;
}
p{
   font-family:'Tahoma'
   background-color:yellow;
}
body{
   font-family:'Tahoma'
   background-color:green;
}

I pass the file to file as command line argument, but it has not effect. if I pass a background color embedded in the file, something like

data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow== which is a red background color, it works ok, and i get the red background for the image.

I want to be able to use regular css file and be able to specify the fonts as well.

Any suggestion is more than welcome.

Edit: I've tried all the solution on this question and others but still no where

Same Problem with soultion (did not work with me)

Tx

Community
  • 1
  • 1
yazwas
  • 101
  • 1
  • 9
  • How are you "passing" CSS styles to `wkhtmltopdf`? You need to have the `test.css` linked with the HTML file, or include the contents of the stylesheet inside HTML's ` – Arman H Apr 07 '14 at 11:34
  • @ArmanH I'm using wkhtmltoimage not topdf. and I'm passing the file as regular .css file. the file I'm using is the one I've posted above. my main aim is to take a picture of a website, but its using fonts that dont show correctly with wkhtmltoimage, and thats why i want to use a different fonts. is that possible with images or only works with pdfs? Thanks! – yazwas Apr 07 '14 at 21:51
  • I'm not very experienced with `wkhtmltoimage`, I need to experiment a little and get back to you in that regard. – Arman H Apr 07 '14 at 22:02
  • Have you tried --allow config option? documentation on wkhtmltoimage http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltoimage_0.10.0_rc2-doc.html – Hbksagar Jun 24 '14 at 07:52
  • @ArmanH where you able to experiment alittle with wkhtmltoimage? I have not been able to do it yet – yazwas Jul 05 '14 at 14:37

0 Answers0