Sha256: 9a2786c3878344d87348e7b363470f1d7f518614123f31610028457f71802365

Contents?: true

Size: 682 Bytes

Versions: 4

Compression:

Stored size: 682 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
        @page.text
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/element/poppler-page.rb
rabbit-3.0.2 lib/rabbit/element/poppler-page.rb
rabbit-3.0.1 lib/rabbit/element/poppler-page.rb
rabbit-3.0.0 lib/rabbit/element/poppler-page.rb