【问题标题】:hexapdf page orientation and content sequencehexapdf 页面方向和内容顺序
【发布时间】:2019-08-30 03:11:18
【问题描述】:

我在这个 gem 中使用hexapdf 来创建 pdf 和新手,所以我想要一些关于以下问题的解决方案。

1) 如何在hexapdf gem 的页面中从顶部而不是底部设置页面内容,以及我们如何以百分比形式给出高度、宽度和 at 参数。”

2)如何在此导入新字体。

请给我一些解决这些问题的方法

【问题讨论】:

    标签: ruby-on-rails ruby pdf pdf-generation


    【解决方案1】:

    答案如下。

    1) composer 将有助于从上到下创建文档。

    2) 像这样导入字体。

    示例:

    HexaPDF::Composer.create('composer.pdf') do |pdf|
      font_name = "path_of_file.ttf"
      text_style = pdf.base_style.dup.update(font: font_name)
      pdf.text("this is some text", style: text_style)
    end
    

    【讨论】:

      猜你喜欢
      • 2017-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-12
      • 2018-12-23
      • 2017-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多