lib/pdf/core/page.rb in prawn-templates-0.1.0 vs lib/pdf/core/page.rb in prawn-templates-0.1.1

- old
+ new

@@ -1,8 +1,9 @@ module PDF module Core class Page #:nodoc: + alias __initialize initialize def initialize(document, options = {}) @document = document @margins = options[:margins] || { left: 36, right: 36, @@ -34,14 +35,17 @@ @content = document.ref({}) dictionary.data[:Contents] << document.state.store[@content] document.open_graphics_state end - def imported_page? - @imported_page + unless method_defined? :imported_page? + def imported_page? + @imported_page + end end + alias __dimensions dimensions if method_defined? :dimensions def dimensions return inherited_dictionary_value(:MediaBox) if imported_page? coords = PDF::Core::PageGeometry::SIZES[size] || size [0, 0] + @@ -54,10 +58,13 @@ raise PDF::Core::Errors::InvalidPageLayout, 'Layout must be either :portrait or :landscape' end end + if method_defined? :init_from_object + alias __init_from_object init_from_object + end def init_from_object(options) @dictionary = options[:object_id].to_i if options[:page_template] dictionary.data[:Parent] = document.state.store.pages end @@ -69,9 +76,10 @@ @stamp_stream = nil @stamp_dictionary = nil @imported_page = true end + alias __init_new_page init_new_page if method_defined? :init_new_page def init_new_page(options) @size = options[:size] || 'LETTER' @layout = options[:layout] || :portrait @stamp_stream = nil