Method: Origami::PDF#insert_page
- Defined in:
- lib/origami/page.rb
#insert_page(index, page = Page.new) {|page| ... } ⇒ Object
Inserts a page at position index into the document.
- index
-
Page index (starting from zero).
- page
-
The page to insert into the document. Creates a new one if none given.
Pass the Page object if a block is present.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/origami/page.rb', line 57 def insert_page(index, page = Page.new) unless self.Catalog and self.Catalog.Pages and self.Catalog.Pages.is_a?(PageTreeNode) raise InvalidPageTreeError, "Invalid page tree" end # Page from another document must be exported. page = page.export if page.document and page.document != self self.Catalog.Pages.insert_page(index, page) yield(page) if block_given? self end |