Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Font issue when generating PDF from URL #161

Blakey opened this Issue · 4 comments

4 participants



I am running the following code :

require 'pdfkit'

PDFKit.configure do |config|
config.wkhtmltopdf = 'C:/wkhtmltopdf/wkhtmltopdf.exe'
config.default_options = {
:page_size => 'Legal',
:print_media_type => true}

preview_article_url = """#{preview_article_url}")

but it doesnt render all of the article correctly as shown in the image below:

Is this to do with the fonts PDFkit is using? I have downloaded the GNU Unicode font but cannot get it to work. Does anybody have any suggestions of better code to do this or know whether the issue is something different?



No ideas anybody ?? :(


I have solved a similar issue: pdfkit can't render a Chinese web page on ubuntu server correctly. I suggest you to check the following condition:
1. make sure your css rule declared in @media all or @media print
2. if you use custom web font face, make sure load it use correct URI(I find that a relative path will not work),such as

@media all{
      font-family: WenQuanYiMicroHeiMono;
      src:url('http://<%=@host%>:<%=@port%>/pdf-fonts/WenQuanYiMicroHeiMono.ttf') format('truetype');

This is likely a limitation of wkhtmltopdf, how it is compiled for your server, or the fonts that wkhtmltopdf can find (as @dongyuwei suggests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.