Rails wicked_pdf适用于Heroku而非本地

时间:2017-04-27 13:32:13

标签: ruby-on-rails wkhtmltopdf wicked-pdf

我正在使用wicked_pdf在Rails 3.2应用程序中生成PDF。

GEM文件:

date

它在Heroku上运行良好,但我在本地MAC上出错:

gem 'wicked_pdf', '0.9.6'
gem 'combine_pdf'
gem 'wkhtmltopdf-binary', '0.9.9.1'

2 个答案:

答案 0 :(得分:1)

之前我遇到了同样的错误,并通过以下步骤修复。

WickedPdf.config = { exe_path: '/usr/local/bin/wkhtmltopdf' } 中,设置如下配置:

<nav id="navigation" role="navigation">

<div class="row">
    <div class="col-md-9">
        <ul class="nav1">
 
			<#list nav_items as nav_item>
			<li><a href="${nav_item.getURL()}">${nav_item.getName()}</a>
						
				 <#if nav_item.hasChildren()>
					<div class="fulldrop">
					
					<#list nav_item.getChildren() as nav_child>
					
					<div class="col-xs-4">
						<#assign  navchild_name = nav_child.getName() />
					 	
						 	<h3>${nav_child.getName()}</h3>
						 	
						 	<br>	
						 		<#if nav_child.hasChildren()>
						 			
						 			<ul>
						 				<#list  nav_child.getChildren() as nav_child>
						 				<li><a href="${nav_child.getURL()}">${nav_child.getName()}</a></li>
						 				</#list>
						 			</ul>
						 			
						 			</#if>  
					</div>			
						
				 	</#list>
				 	</div>
				 </#if>
			</li>
			</#list>
   		</ul>
     </div>
     
</div>

</nav>

答案 1 :(得分:0)

在您的宝石文件中尝试以下操作:

gem 'wicked_pdf'
gem 'wkhtmltopdf-binary',       group: [:development]
gem 'wkhtmltopdf-binary-edge',  group: [:production, :staging]