I\'m using wkhtmltopdf to download a webpage as pdf.
But the css property letter-spacing seems doesn\'t work
font-size:20px; letter-spacing:0px;
<
in the CSS add the Following Code for Body
body {
font-kerning: normal;
text-rendering: optimizeLegibility;
}
and the --dpi 200. This Worked for Me.
I had the same problem, I set the dpi to 96 (in wkhtmltopdf options) and worked, not sure why though.
Using wkhtmltopdf 0.12.4 or 0.12.5 on Windows you can use --dpi 300
on the wkhtmltopdf
command line, to almost solve the issue. If you zoom a lot you may still notice some letters have negligible differences in spacing, but the letters no longer overlap. And with --dpi 600
makes it almost perfect. The rendered pdf file size was not increased in my scenarios.
I had the same issue and I have solved it by
sudo wget http://pastebin.com/raw.php?i=AmfYN3er -O /etc/fonts/conf.d/10-wkhtmltopdf.conf
http://www.jeremydaly.com/how-to-install-wkhtmltopdf-on-amazon-linux/
I had the same issue. I had to add the flage --disable-smart-shrinking and then played with dpi by increasing and decreasing progressively.
wkhtmltopdf --page-size A4 --print-media-type --lowquality --disable-smart-shrinking --encoding UTF-8 --no-outline --image-quality 100 --javascript-delay 3000 --orientation Portrait --dpi 65 --margin-top 0in --margin-right 0in --margin-bottom 0in --margin-left 0in "http://localhost:3000/wa/reports/"
Issue every one face with letter spacing, perfect solution is here.
import pdfkit
#SnippetBucket.com code for pdfkit
path_wkthmltopdf = r'/var/www/aukcnydom/wkhtmltox/bin/wkhtmltopdf'
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
#more better and more accurate code for DPI set
config.default_options = {
'page_size': 'A4',
'print_media_type': True,
'dpi': 96
}
pdfkit.from_string(mark_safe(unicode(self.document)),settings.MEDIA_ROOT +"/"+ path, options=options, css=style, configuration=config)
Than in css. Add your letter-spacing.
p{letter-spacing: 0.4mm !important; text-align: justify ; font-kerning: normal; text-rendering: optimize-speed;}
/* SNIPPETBUCKET.COM, CSS CODE WITH LETTER SPACING */
This way simply resolve your issue and work perfectly letter spacing.
Note: I had given sample, you may apply applicable changes with your code.