README.rdoc in gbdev-pdf_filler-0.3.0 vs README.rdoc in gbdev-pdf_filler-0.3.1
- old
+ new
@@ -86,10 +86,24 @@
book.add_page(page1)
book.add_page(page2)
book.save_to('/page/to/book.pdf')
-
+5. Rather then setting all the fields manually a PDF can be mapped to an ActiveRecord model.
+ The model must use the acts_as_pdf_db_mapper module. (<b><i>See rdocs on acts_as_pdf_db_mapper for more options</i></b>)
+
+ class User < ActiveRecord::Base
+ ...
+ acts_as_pdf_db_mapper
+ ...
+ end
+
+ user = User.first
+ page = GBDev::PDF::Page.new('/path/to/template1.pdf')
+ page.map_to_object(user)
+ page.save_to('/path/to/save.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')