Class: DragonflyPdf::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly_pdf/plugin.rb

Instance Method Summary collapse

Instance Method Details

#call(app, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dragonfly_pdf/plugin.rb', line 7

def call app, opts={}
  app.add_analyser :pdf_properties, DragonflyPdf::Analysers::PdfProperties.new

  app.add_analyser :page_count do |content|
    content.analyse(:pdf_properties)[:page_count]
  end

  app.add_analyser :spread_count do |content|
    content.analyse(:pdf_properties)[:spread_count]
  end

  app.add_analyser :page_numbers do |content|
    content.analyse(:pdf_properties)[:page_numbers]
  end

  app.add_analyser :widths do |content|
    content.analyse(:pdf_properties)[:widths]
  end
  
  app.add_analyser :heights do |content|
    content.analyse(:pdf_properties)[:heights]
  end
  
  app.add_analyser :aspect_ratios do |content|
    attrs = content.analyse(:pdf_properties)[:aspect_ratios]
  end

  app.add_analyser :info do |content|
    attrs = content.analyse(:pdf_properties)[:info]
  end
  
  # ---------------------------------------------------------------------
  
  app.add_processor :page_thumb, DragonflyPdf::Processors::PageThumb.new
end