class Squib::Graphics::SaveSpruePDF
Templated sheet renderer in PDF format.
Public Instance Methods
draw_final_page(cc)
click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 193 def draw_final_page(cc) # PDF doesn't need to create a last page. See bug #320 cc.target.finish end
draw_page(cc)
click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 186 def draw_page(cc) cc.show_page cc.set_source_color(:white) # white backdrop TODO make option cc.paint cc end
full_filename()
click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 198 def full_filename @sheet_args.full_filename end
init_cc()
click to toggle source
# File lib/squib/graphics/save_sprue.rb, line 160 def init_cc ratio = 72.0 / @deck.dpi slots = @tmpl.cards per_sheet = slots.size surface = if per_sheet == 1 Cairo::PDFSurface.new( full_filename, (@tmpl.sheet_width - 2 * @sheet_args.trim) * ratio, (@tmpl.sheet_height - 2 *@sheet_args.trim) * ratio ) else Cairo::PDFSurface.new( full_filename, @tmpl.sheet_width * ratio, @tmpl.sheet_height * ratio ) end cc = CairoContextWrapper.new(Cairo::Context.new(surface)) # cc = Cairo::Context.new(surface) cc.scale(72.0 / @deck.dpi, 72.0 / @deck.dpi) # make it like pixels cc end