class PDF::Inspector::Page

Attributes

pages[R]

Public Class Methods

new() click to toggle source
# File lib/pdf/inspector/page.rb, line 12
def initialize
  @pages = []
end

Public Instance Methods

page=(page) click to toggle source
# File lib/pdf/inspector/page.rb, line 16
def page=(page)
  @pages << { size: page.attributes[:MediaBox][-2..-1], strings: [] }
  @state = PDF::Reader::PageState.new(page)
end
show_text(*params) click to toggle source
# File lib/pdf/inspector/page.rb, line 21
def show_text(*params)
  params.each do |param|
    @pages.last[:strings] << @state.current_font.to_utf8(param)
  end
end
show_text_with_positioning(*params) click to toggle source
# File lib/pdf/inspector/page.rb, line 27
def show_text_with_positioning(*params)
  # ignore kerning information
  show_text params[0].reject { |e|
    e.is_a? Numeric
  }.join
end