-2

我正在使用 Ruby 2.5.3p105 和 Rails 5.2.0 。和 gem 'wicked_pdf' 1.1.0 用于 pdf 下载。从下图中,悬停时我会在顶部看到栏,其中包括标题、页码、旋转、下载、打印等几项内容,最后一个是书签。我想从此工作表中删除书签。我怎样才能做到这一点?

在此处输入图像描述

我的代码是:

home_controller.rb:

pdf = render_to_string pdf: "#{@selected_scheme_code}.pdf", 
                            template: "/home/overview_download.html.erb", 
                            encoding: "UTF-8", 
                            layout: 'pdf.html.erb',
                            disposition: "attachment",
                            title: "Fund Factsheet",                               
                            :page_size => "A4",
                            margin: {top: 0,
                                  bottom: 0,
                                  left: 0,
                                  right: 0},                             
                            :javascript_delay => 5000,
                            save_to_file: save_path, 
                            :extra => '--no-stop-slow-scripts',                                
                            save_only: true
    File.open(save_path, "wb") do |file|
        file << pdf
      end
4

1 回答 1

1

当您创建 pdf 文件时,此文件具有标题、内容、... 您使用 PDF 查看器打开此文件,会显示标题和页码、下载、打印、书签按钮是 PDF 查看器选项。所以你不能从中删除书签按钮。:D

于 2019-03-27T14:57:57.257 回答