我有几个pdf文件,可以使用以下代码组合成单个pdf,名为combined.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
答案 0 :(得分:0)
https://github.com/yutayamamoto/pdfoutline 我制作了一个库,可以帮助您将轮廓添加到PDF文件中,尽管它不是用ruby编写的。