Class: Mork::SheetPDF
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- Mork::SheetPDF
- Defined in:
- lib/mork/sheet_pdf.rb
Overview
Generating response sheets as PDF files. See the README file for usage
Instance Method Summary collapse
-
#initialize(content, layout = nil, duplex = false) ⇒ SheetPDF
constructor
A new instance of SheetPDF.
-
#save(fname) ⇒ Object
Saving the PDF file to disk.
-
#to_pdf ⇒ Object
The PDF document as a string.
Constructor Details
#initialize(content, layout = nil, duplex = false) ⇒ SheetPDF
Returns a new instance of SheetPDF.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mork/sheet_pdf.rb', line 10 def initialize(content, layout=nil, duplex=false) @content = case content when Array; content when Hash; [content] when String fail Errno::ENOENT unless File.exists? content symbolize YAML.load_file(content) end @grip = case layout when NilClass; GridPDF.new when String, Hash; GridPDF.new layout when Mork::GridPDF; layout else raise ArgumentError, 'Invalid initialization parameter' end super my_page_params @duplex = duplex process end |
Instance Method Details
#save(fname) ⇒ Object
Saving the PDF file to disk
34 35 36 |
# File 'lib/mork/sheet_pdf.rb', line 34 def save(fname) render_file fname end |
#to_pdf ⇒ Object
The PDF document as a string
39 40 41 |
# File 'lib/mork/sheet_pdf.rb', line 39 def to_pdf render end |