【问题标题】:wicked pdf side issue邪恶的pdf副刊
【发布时间】:2014-06-27 22:08:29
【问题描述】:

我正在使用 wicked pdf 导出表格

这里是使用 wicked 的控制器

def print_invoice

  respond_to do |format|

    format.pdf{ 
      send_data render(
        ####### WICKED CODE ######
        :pdf => "invoices",
        :margin => {:top=> 0,:bottom => 0,:left=> 0,:right => 0},
        :orientation => "Landscape",
        :print_media_type => true,:disable_smart_shrinking => true)
        )
        ####### END WICKED CODE ######
    }       
  end      
end

这是打印视图

<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>  
<body>
  <table  border="1"  align="left">
  </table>
</body>
</html>

这是我得到的 pdf

我想要这个在左侧,但不工作

我试过了,一无所获:

 :margin => {:top=> 0,:bottom => 0,:left=> -10,:right => 0},

有人可以帮助我吗?

【问题讨论】:

  • 可能“0”不是页面的有效值,请尝试使用较小的值而不是 0
  • 我的意思是一个小的正数,比如 1 或 0.1,我不知道 wicked_pdf 上边距的有效值是多少,也许你也需要指定一些度量单位,比如 pt 或 px 跨度>

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


【解决方案1】:

是的,这是一个位置边距,试试这个代码:

:margin => {:top=> 0,:bottom => 0,:left=> 0.1,:right => 0},

正如 arieljuod 所说,你必须这样做。

【讨论】:

    猜你喜欢
    • 2013-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-12
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多