Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hidakatsuya/1150942 to your computer and use it in GitHub Desktop.
Save hidakatsuya/1150942 to your computer and use it in GitHub Desktop.
ThinReports Example: Multiple Layouts
# coding: utf-8
require 'rubygems'
require 'thinreports'
report = ThinReports::Report.create do
use_layout 'multiple_default', :default => true
use_layout 'multiple_cover', :id => :cover
# Add :cover layout (using multiple_cover.tlf).
start_new_page :layout => :cover
# Add 5 page using :default layout (multiple_default.tlf).
5.times do |t|
start_new_page do |page|
page.item(:content).value(t + 1)
end
end
# Add "multiple_back_cover.tlf" layout.
start_new_page :layout => 'multiple_back_cover.tlf'
end
report.generate_file('multiple_layouts.pdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment