Class: PDF::Core::Page
- Inherits:
-
Object
- Object
- PDF::Core::Page
- Defined in:
- lib/pdf/core/page.rb
Overview
:nodoc:
Instance Method Summary collapse
- #init_from_object(options) ⇒ Object
-
#new_content_stream ⇒ Object
As per the PDF spec, each page can have multiple content streams.
Instance Method Details
#init_from_object(options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdf/core/page.rb', line 19 def init_from_object() @dictionary = [:object_id].to_i dictionary.data[:Parent] = document.state.store.pages if [:page_template] unless dictionary.data[:Contents].is_a?(Array) # content only on leafs @content = dictionary.data[:Contents].identifier end @stamp_stream = nil @stamp_dictionary = nil @imported_page = true end |
#new_content_stream ⇒ Object
As per the PDF spec, each page can have multiple content streams. This will add a fresh, empty content stream this the page, mainly for use in loading template files.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pdf/core/page.rb', line 8 def new_content_stream return if in_stamp_stream? unless dictionary.data[:Contents].is_a?(Array) dictionary.data[:Contents] = [content] end @content = document.ref({}) dictionary.data[:Contents] << document.state.store[@content] document.open_graphics_state end |