質問

RailsアプリでPDFKITを使用してPDFを生成しています。問題は、私のコンテンツの一部にASCII以外の文字が含まれていることです。 UTF-8の使用を強制するにはどうすればよいですか?

役に立ちましたか?

解決

HTMLヘッドにこれを追加することで修正しました:

<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