require 'spec_helper' module Mork describe SheetPDF do it "should create a basic pdf" do info = { code: 1099511627775, choices: [5] * 120, header: { name: "Bertini Giuseppe VR123456", title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013", code: "119.27", signature: "Firma" }, control: { string: "Annerisci solo la casella ā€˜Vā€™:", labels: ['V', 'F'] } } grid_opts = { regmarks: { margin: 10, radius: 2.5, search: 10 }, header: { name: { top: 5, left: 7.5, width: 170, size: 14, }, title: { top: 15, left: 7.5, width: 180, size: 12 }, code: { top: 5, left: 165, width: 20, size: 14 }, signature: { top: 30, left: 7.5, width: 120, height: 15, size: 7, box: true, } }, # header end responses: { columns: 4, column_width: 49, rows: 30, # from the top-left registration mark # to the center of the first choice cell first_x: 10.5, first_y: 55.5, # between choices x_spacing: 7.0, # between rows y_spacing: 7.0, # darkened area cell_width: 6.0, cell_height: 5.0, # the maximum number of choices per question max_cells: 5, # font size for the question number number_size: 10, # distance between right side of q num and left side of first choice cell number_width: 8, # width of question number text box number_margin: 2, # font size for the choice letter letter_size: 8 }, code: { bits: 40, left: 15, width: 3.0, height: 2.5, spacing: 4 }, control: { top: 40, left: 123, width: 50, size: 9, margin: 2.5 } } # s = SheetPDF.new(Grid.new(grid_opts), info) # s.save("tmp/f1.pdf") info = { code: 5512, choices: [5] * 160, header: { name: "Bonazza Sara vr354320", title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013", code: "201.48", signature: "Firma" } } s = SheetPDF.new(Grid.new, info) s.save("tmp/f2.pdf") info = { code: 8928348236, choices: [5] * 160, header: { name: "G" * 60, title: "E" * 100, code: "119.28", signature: "Firma" } } s = SheetPDF.new(Grid.new, info) s.save("tmp/f3.pdf") end it "should create a multipage pdf" do info = [ { code: 18446744073709551615, choices: [5] * 100, header: { name: "Bertini Giuseppe VR123456 Bertini Giuseppe VR123456", title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013 Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013", code: "119.27", signature: "Firma" } }, { code: 5512, choices: [5] * 160, header: { name: "Bonazza Sara vr354320", title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013", code: "201.48", signature: "Firma" } } ] s = SheetPDF.new(Grid.new, info) s.save("tmp/p2.pdf") end end end