module TeachingPrintables::Factory
Rubber stamps common worksheets
Public Class Methods
avery5371_with_array_content(content_array,output_file_name="output.pdf")
click to toggle source
# File lib/teaching_printables/factory.rb, line 6 def Factory.avery5371_with_array_content(content_array,output_file_name="output.pdf") doc = TeachingPrintables::TPDocument.new class << doc include TeachingPrintables::Templatable end doc.create_page_with_template(:avery5371) doc.add_grid_content(content_array) doc.save_as(output_file_name) puts "Sheet saved as #{output_file_name}." end
base_tens_shapes_paper(npages,rule_value=1,rule_unit='cm',filename='output.pdf')
click to toggle source
# File lib/teaching_printables/factory.rb, line 46 def Factory.base_tens_shapes_paper(npages,rule_value=1,rule_unit='cm',filename='output.pdf') npages = npages.to_i rule = rule_unit.empty? ? rule_value.to_f : rule_value.to_f.send(rule_unit) if !filename || filename.empty? filename = 'output.pdf' end doc = TeachingPrintables::TPDocument.new class << doc include Shapeable include QuadRulable end npages.times do |i| doc.create_quad_rule(rule_unit: rule, start_new_page: true) doc.create_tens_and_ones_shapes(rule_unit: rule, start_new_page: false) doc.text_box "Name:", :at => [2.cm, doc.bounds.top - 1.cm] doc.line_width = 2 doc.stroke_color = "000000" doc.stroke_line [3.5.cm,doc.bounds.top - 1.5.cm], [10.cm,doc.bounds.top - 1.5.cm] doc.text_box "Date:", :at => [12.cm, doc.bounds.top - 1.cm] doc.stroke_line [13.cm,doc.bounds.top - 1.5.cm], [20.cm,doc.bounds.top - 1.5.cm] end doc.save_as(filename) end
centimeter_number_lines(output_file_name = "output.pdf")
click to toggle source
# File lib/teaching_printables/factory.rb, line 73 def Factory.centimeter_number_lines(output_file_name = "output.pdf") doc = TeachingPrintables::TPDocument.new class << doc include Gridable end update_grid_options(grid_rows: 5, grid_columns: 1) end
centimeter_paper()
click to toggle source
# File lib/teaching_printables/factory.rb, line 17 def Factory.centimeter_paper doc = TeachingPrintables::TPDocument.new class << doc include QuadRulable end 2.times do |i| doc.create_quad_rule(start_new_page: true) end doc.save_as(output_file_name) end
hundreds_grid(output_file_name="output.pdf")
click to toggle source
# File lib/teaching_printables/factory.rb, line 82 def Factory.hundreds_grid(output_file_name="output.pdf") qr=TeachingPrintables::TPDocument.new class << qr include QuadRulable end 2.times do |i| qr.create_quad_rule(start_new_page: true) qr.line_width = 4 qr.stroke_rectangle [1.cm,11.cm], 10.cm, 10.cm qr.stroke_line [6.cm,11.cm], [6.cm,21.cm] qr.stroke_rectangle [1.cm,22.cm], 10.cm, 10.cm qr.stroke_line [6.cm,21.cm], [6.cm,31.cm] end qr.save_as(output_file_name) end
quad_ruled_paper(npages,rule_value,rule_unit='',filename='output.pdf')
click to toggle source
# File lib/teaching_printables/factory.rb, line 28 def Factory.quad_ruled_paper(npages,rule_value,rule_unit='',filename='output.pdf') npages = npages.to_i rule = rule_unit.empty? ? rule_value.to_f : rule_value.to_f.send(rule_unit) if !filename || filename.empty? filename = 'output.pdf' end doc = TeachingPrintables::TPDocument.new class << doc include QuadRulable end npages.times do |i| doc.create_quad_rule(rule_unit: rule, start_new_page: true) end doc.save_as(filename) end