Class: Prune::Elements::Catalog

Inherits:
Base
  • Object
show all
Includes:
Prune
Defined in:
lib/prune/elements/catalog.rb

Constant Summary

Constants included from Prune

APPLICATION, DOCUMENT_SIZES, LF, PAGE_LAYOUT, VERSION

Instance Attribute Summary

Attributes inherited from Base

#document

Instance Method Summary collapse

Methods included from Prune

pdf

Methods inherited from Base

#reference, #register, #to_s

Methods included from Functions

#mm_to_pt, #pt_to_mm

Methods included from PObjects

pa, pd, ph, pl, pn, ps

Constructor Details

#initialize(document) ⇒ Catalog

Initialize.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/prune/elements/catalog.rb', line 9

def initialize(document)
  super(document)
  # Set dictionary.
  @content = pd(
    pn(:Type) => pn(:Catalog),
    pn(:PageLayout) => pn(:SinglePage),
    pn(:Lang) => pl("ja-JP"),
    pn(:ViewerPreferences) => pd(
      pn(:FitWindow) => true))
  # Register element to document.
  register
end

Instance Method Details

#lang=(lang) ⇒ Object

Set lang.



35
36
37
# File 'lib/prune/elements/catalog.rb', line 35

def lang=(lang)
  @content[pn(:Lang)] = lang
end

#outlines=(reference) ⇒ Object

Set reference to outlines.



23
24
25
# File 'lib/prune/elements/catalog.rb', line 23

def outlines=(reference)
  @content.update(pn(:Outlines) => reference)
end

#page_layout=(layout) ⇒ Object

Set page layout.



28
29
30
31
32
# File 'lib/prune/elements/catalog.rb', line 28

def page_layout=(layout)
  if PAGE_LAYOUTS.include?(layout)
    @content.update(pn(:PageLayout) => layout)
  end
end

#pages=(pages) ⇒ Object

Set reference to pages.



45
46
47
# File 'lib/prune/elements/catalog.rb', line 45

def pages=(pages)
  @content[pn(:Pages)] = pages
end

#version=(version) ⇒ Object

Set pdf version.



40
41
42
# File 'lib/prune/elements/catalog.rb', line 40

def version=(version)
  @content[pn(:Version)] = version
end