Module: Vivlio::PDF::Outline

Defined in:
lib/vivlio/pdf/outline.rb

Overview

How PDF bookmarks are produced. Each strategy answers two questions: whether Chromium should build the outline itself while printing, and which TOC entries (if any) we write afterwards with HexaPDF.

Defined Under Namespace

Classes: Headings, None, Strategy, Toc

Class Method Summary collapse

Class Method Details

.resolve(mode) ⇒ Object

Accepts a Strategy, a mode name, or a boolean for callers who think of bookmarks as something they simply turn on or off.



11
12
13
14
15
16
17
18
19
# File 'lib/vivlio/pdf/outline.rb', line 11

def self.resolve(mode)
  case mode
  when Strategy then mode
  when :toc, 'toc', nil, true then Toc.new
  when :headings, 'headings' then Headings.new
  when :none, 'none', false then None.new
  else raise ArgumentError, "unknown outline mode: #{mode.inspect}"
  end
end