【问题标题】:is there any way to add outlines(bookmarks) to existed pdf in ruby有什么方法可以在 ruby​​ 中为现有的 pdf 添加大纲(书签)
【发布时间】:2017-10-03 13:17:28
【问题描述】:

我的 pdf 文件很少,可以使用以下代码组合成一个名为 combine.pdf 的单个 pdf。

pdf = CombinePDF.new
pdf << CombinePDF.load("1.pdf")
 # one way to combine, very fast.
pdf << CombinePDF.load("2.pdf")
pdf << CombinePDF.load("3.pdf")
pdf << CombinePDF.load("4.pdf")
pdf.save "combined.pdf"

现在我想为这个combined.pdf 添加大纲。 尝试与虾,但没有运气。这是我尝试过的代码

Prawn::Document.generate("full_template.pdf", :template => filename) do
  text "THis content is written on the first page of the template", :align => :center

  outline.define do
   section("Slaves", :destination => 1) do
     page :title => "Page 2", :destination => 2
     page :title => "Page 3", :destination => 3
   end
  end
end

【问题讨论】:

    标签: ruby-on-rails ruby pdf prawn


    【解决方案1】:

    https://github.com/yutayamamoto/pdfoutline 我创建了一个库,可以帮助您向 PDF 文件添加大纲,尽管它不是用 ruby​​ 编写的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-11
      • 1970-01-01
      • 2015-08-09
      • 1970-01-01
      相关资源
      最近更新 更多