[英]is there any way to add outlines(bookmarks) to existed pdf in ruby
I have few pdf files and could combine into single pdf called combined.pdf with the following code.我的 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"
Now I want to add outlines to this combined.pdf.现在我想为这个combined.pdf 添加大纲。 Trying with the prawn, but no luck.
尝试与大虾,但没有运气。 Here is the code that i have tried
这是我尝试过的代码
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
https://github.com/yutayamamoto/pdfoutline我制作了一个库,可以帮助您将大纲添加到 PDF 文件中,尽管它不是用 ruby 编写的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.