lib/pdf_filler/book.rb in gbdev-pdf_filler-0.2.0 vs lib/pdf_filler/book.rb in gbdev-pdf_filler-0.3.0

- old
+ new

@@ -8,17 +8,19 @@ def initialize() @pages = [] end # Add a page to the book + # + # * new_page - The page object of type GBDev::PDF::Page def add_page(new_page) @pages << new_page end - # Renders the book with the given pages and saves to the given filename path. + # Renders the PDF Book and saves it to the specified file. # - # String filename : A path to the file to be created. + # * filename - A path to the file to be created. def save_to(filename) dir = File.dirname(filename) temp_dir = [dir, "collection_temp_#{build_random_string}"].join('/') Dir.mkdir(temp_dir) @pages.each_with_index do |page, indx| @@ -40,12 +42,16 @@ document.close FileUtils.rm_rf(temp_dir, {:secure => true}) end + # Renders the PDF Book without saving it to disk and displays it in the browser. def display end + # Renders the PDF Book, saves it to the specified file and then displays the PDF in the browser. + # + # * filename - A path to the file to be created. def save_and_display(filename) save(filename) display end