문제

I'm using PDFKit in my Rails app to generate PDF's. Problem is some of my content in contains non-ascii characters. How do I force it to use UTF-8?

도움이 되었습니까?

해결책

Fixed by adding this to in the html head:

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

다른 팁

You can write in PDFKIT configration.

 PDFKit.configure do |config|
        config.wkhtmltopdf = '/opt/wkhtmltopdf'
        config.default_options = {
          :encoding      => 'UTF-8'
          :page_size     => 'Letter',
          :margin_top    => '0.3in',          
          :margin_bottom => '0.1in',          
          :print_media_type => true                       
        }
 end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top