Class: PDF::Inspector::Page

Inherits:
PDF::Inspector show all
Defined in:
lib/pdf/inspector/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PDF::Inspector

analyze, analyze_file, parse

Constructor Details

#initializePage

Returns a new instance of Page.



6
7
8
# File 'lib/pdf/inspector/page.rb', line 6

def initialize
  @pages = []
end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages.



4
5
6
# File 'lib/pdf/inspector/page.rb', line 4

def pages
  @pages
end

Instance Method Details

#begin_page(params) ⇒ Object



10
11
12
# File 'lib/pdf/inspector/page.rb', line 10

def begin_page(params)
  @pages << {:size => params[:MediaBox][-2..-1], :strings => []}
end

#show_text(*params) ⇒ Object



14
15
16
# File 'lib/pdf/inspector/page.rb', line 14

def show_text(*params)
  @pages.last[:strings] << params[0]
end

#show_text_with_positioning(*params) ⇒ Object



18
19
20
21
# File 'lib/pdf/inspector/page.rb', line 18

def show_text_with_positioning(*params)      
  # ignore kerning information
  @pages.last[:strings] << params[0].reject { |e| Numeric === e }.join
end