def generate(collection)
            @defaults = {
                :style => :normal,
                :size => 12,
                :align => :left,
                :format => false,
                :font => 'Times-Roman',
                :type => :text,
                :color => '000000',
                :fixed => false
            }

            get_sections
            set_pos_y

            @defaults.merge!(@sections[:defaults]) unless @sections[:defaults].nil?
            
            collection = [collection] unless collection.is_a?(Array) or collection.is_a?(ActiveRecord::Relation)
            print_section :page unless @sections[:page].nil?
            set_pos_y (@sections[:body][:settings][:posY] || 0)
            @current_groups = {}
            @footers = {}
            @count = 0

            unless @sections[:groups].empty?
                reset_groups_values
            else
                draw_columns
            end

            initialize_footer_values
            can_print_footer = false

            collection.each do |record|
                @record = record.is_a?(Hash) ? ReportObject.new(record) : record  #Convert the hash on a Object to futurely extend a module

                headers_to_print, headers_height = calculate_header

                unless headers_to_print.empty?
                    @count = 0
                    draw_footer headers_to_print, @sections[:groups] if can_print_footer
                    if @posY - headers_height < 2*@sections[:body][:settings][:height]
                        new_page
                    else
                        headers_to_print.each  { |group| print_section group, @record, true }
                        draw_columns
                    end
                end
                can_print_footer = true

                update_footer_values
                print_section :body, @record
                @count += 1
            end

            draw_footer(@sections[:body][:settings][:groups].collect {|group| group.to_sym}, @sections[:groups]) if has_groups?
            draw_footer [:body], @sections

            @pdf
        end
def generate(collection)
            @defaults = {
                :style => :normal,
                :size => 12,
                :align => :left,
                :format => false,
                :font => 'Times-Roman',
                :type => :text,
                :color => '000000',
                :fixed => false
            }

            get_sections
            set_pos_y

            @defaults.merge!(@sections[:defaults]) unless @sections[:defaults].nil?
            
            collection = [collection] unless collection.is_a?(Array) or collection.is_a?(ActiveRecord::Relation)
            print_section :page unless @sections[:page].nil?
            set_pos_y (@sections[:body][:settings][:posY] || 0)
            @current_groups = {}
            @footers = {}
            @count = 0

            unless @sections[:groups].empty?
                reset_groups_values
            else
                draw_columns
            end

            initialize_footer_values
            can_print_footer = false

            collection.each do |record|
                @record = record.is_a?(Hash) ? ReportObject.new(record) : record  #Convert the hash on a Object to futurely extend a module

                headers_to_print, headers_height = calculate_header

                unless headers_to_print.empty?
                    @count = 0
                    draw_footer headers_to_print, @sections[:groups] if can_print_footer
                    if @posY - headers_height < 2*@sections[:body][:settings][:height]
                        new_page
                    else
                        headers_to_print.each  { |group| print_section group, @record, true }
                        draw_columns
                    end
                end
                can_print_footer = true

                update_footer_values
                print_section :body, @record
                @count += 1
            end

            draw_footer(@sections[:body][:settings][:groups].collect {|group| group.to_sym}, @sections[:groups]) if has_groups?
            draw_footer [:body], @sections

            @pdf
        end
Responsible for generate a report, based on rules passed as parameter in Juno::Report::generate.
Juno Reports has support groups, just by especifying them at the rules file.
Receives a collection as parameter, which should be a Array of records of the report.