README.rdoc in gbdev-pdf_filler-0.2.0 vs README.rdoc in gbdev-pdf_filler-0.3.0
- old
+ new
@@ -62,21 +62,40 @@
== Usage
1. You will need a PDF that has form fields to fill.
-2. A hash of parameters for filling the PDF form. The hash must contain all of the required options:
- * :data (required) - A hash or array of hashes of fields to fill the pdf template with. Example: [{:field => 'value'}, {:field => 'value'}].
- * :template (required) - The full path to the PDF form to fill.
- * :dir (required) - The directory to write filled form to.
- * :file_name (optional) The name of the output file to create. If not specified a random file name will be used.
+2. A writable directory to store the generated PDFs.
-3. Example
- opts = {:data => {:full_name => 'Wes Hays'},
- :template => '/path/to/templates/certificate_template.pdf'),
- :dir => '/path/to/templates/output/'),
- :file_name => 'wes_hays.pdf'}
- PdfFiller(opts)
+3. For a single page use the Page object?
+
+ // ** Single page **
+ page = GBDev::PDF::Page.new('/path/to/template.pdf')
+ page.set_text(:full_name, 'Wes Hays')
+ page.save_to('/path/to/save.pdf')
+
+4. For a collection of pages to be added to a single PDF use a Book object.
+
+ book = GBDev::PDF::Book.new
+
+ page1 = GBDev::PDF::Page.new('/path/to/template1.pdf')
+ page1.set_text(:full_name, 'Wes Hays')
+
+ page2 = GBDev::PDF::Page.new('/path/to/template2.pdf')
+ page2.set_text(:full_name, 'Darren Johnson')
+
+ book.add_page(page1)
+ book.add_page(page2)
+
+ book.save_to('/page/to/book.pdf')
+
+
+Note: You can use the shorter kernel methods PDFPage instead of GBDev::PDF::Page.new. The same goes for PDFBook instead of GBDev::PDF::Book.new.
+
+Example:
+
+ page = PDFPage('/path/to/template.pdf')
+ book = PDFBook()
== License
This plugin is released under the MIT license. Please contact weshays (http://github.com/weshays)