起きたこと
wicked_pdfをEC2にデプロイしたところ表示されず‥
ログを見ると以下エラー
ActionView::Template::Error (The asset "number_pages.js" is not present in the asset pipeline.
対処法
以下の部分を削除
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<%= wicked_pdf_stylesheet_link_tag "pdf" -%>
#--------------削除-------------------------------------
<%= wicked_pdf_javascript_include_tag "number_pages" %>
#----------------------------------------------------------
</head>
<body onload='number_pages'>
<div id="header">
#--------------削除--------------------------------
<%= wicked_pdf_image_tag 'mysite.jpg' %>
#-------------------------------------------------
</div>
<div id="content">
<%= yield %>
</div>
</body>
</html>
原因
公式のこの部分
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<%= wicked_pdf_stylesheet_link_tag "pdf" -%>
<%= wicked_pdf_javascript_include_tag "number_pages" %>
</head>
<body onload='number_pages'>
<div id="header">
<%= wicked_pdf_image_tag 'mysite.jpg' %>
</div>
<div id="content">
<%= yield %>
</div>
</body>
</html>
をそのまま持ってきてたのでwicked_pdf_javascript_include_tag "number_pages"
の部分は今回は使ってなかったからエラーが起きたのだと思われ
現にwicked_pdf_javascript_include_tag "number_pages"
の部分を削除したら今度は
以下のエラーが出たのでここも今回は不要ってことでこれも削除
ActionView::Template::Error (The asset "mysite.jpg" is not present in the asset pipeline.
その後
その後無事PDF出力はしたが今度は英語と数字部分は出力されるが日本語部分が出力されず‥
対処法
Linuxには日本語が入っていないらしいので
以下をcurrent内でインストール
$ yum install -y ipa-gothic-fonts
$ yum install -y ipa-mincho-fonts
これで無事表示された!
参考