Skip to content

paulopessoa/jasper-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jasper-bridge

A bridge from RubyOnRails to Jasper.

Requires

Java (JDK) - www.oracle.com/technetwork/java/javase/downloads/index.html

Install

In Gemfile:

gem 'jasper-bridge'

Run ‘bundle install’.

Use

1.In controller class:

require 'jasper-bridge'
class ProductsController < ApplicationController
  include Jasper::Bridge
  ...
end

2.Put jasper file in “#{Rails.root}/reports” directory.

3.In action of the controller, call method ‘send_doc’ to response the report. Like the example:

def index
  @products = Product.all
  send_doc(@products.to_xml, '/products/product', 'Products.jasper', "Products", params[:output_type])
end

The parameters in order of ‘send_doc’ are:

content of XML
Xpath of XML node used
name of the jasper file
name used for file save (without extesion)
extension string of filetype returned ('pdf', 'csv', 'rtf', 'html'). Types differents of pdf are not tested.

Jasper Lib Versions

The java libs on this gem is from JasperReports 3.7.6. So reports must be compiled in the same version.

Copyright © 2011 paulopessoa. See LICENSE.txt for further details.

About

Way from Ruby to Jasper via IO.popen to show Jasper reports.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published