Sha256: ec5eca2d8a7d5c0abf5405f46dd27a2dc1aebcb1ccf160361903411725bf65e9

Contents?: true

Size: 763 Bytes

Versions: 36

Compression:

Stored size: 763 Bytes

Contents

require 'rabbit/element/block-element'

module Rabbit
  module Element
    class PopplerPage
      include Base
      include BlockElement
      include BlockHorizontalCentering

      def initialize(page)
        @page = page
        super()
      end

      def draw_element(canvas, x, y, w, h, simulation)
        unless simulation
          canvas.draw_poppler_page(@page, x, y, :width => w, :height => h)
        end
        [x, y + height, w, h - height]
      end

      def title
        text.split(/\r?\n/, 2).first
      end

      def text
        rectangle = Poppler::Rectangle.new(0, 0, @width, @height)
        @page.get_text(rectangle)
      end

      def clear_theme
        super
        @width, @height = @page.size
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
rabbit-2.2.1 lib/rabbit/element/poppler-page.rb
rabbit-2.2.0 lib/rabbit/element/poppler-page.rb
rabbit-2.1.9 lib/rabbit/element/poppler-page.rb
rabbit-2.1.8 lib/rabbit/element/poppler-page.rb
rabbit-2.1.7 lib/rabbit/element/poppler-page.rb
rabbit-2.1.6 lib/rabbit/element/poppler-page.rb
rabbit-2.1.5 lib/rabbit/element/poppler-page.rb
rabbit-2.1.4 lib/rabbit/element/poppler-page.rb
rabbit-2.1.3 lib/rabbit/element/poppler-page.rb
rabbit-2.1.2 lib/rabbit/element/poppler-page.rb
rabbit-2.1.1 lib/rabbit/element/poppler-page.rb
rabbit-2.1.0 lib/rabbit/element/poppler-page.rb
rabbit-2.0.9 lib/rabbit/element/poppler-page.rb
rabbit-2.0.8 lib/rabbit/element/poppler-page.rb
rabbit-2.0.7 lib/rabbit/element/poppler-page.rb
rabbit-2.0.6 lib/rabbit/element/poppler-page.rb
rabbit-2.0.5 lib/rabbit/element/poppler-page.rb
rabbit-2.0.4 lib/rabbit/element/poppler-page.rb
rabbit-2.0.3 lib/rabbit/element/poppler-page.rb
rabbit-2.0.2 lib/rabbit/element/poppler-page.rb