Sha256: 382ec1fd319e19a91e93dc436e0c053efbe8d1029068801616d62f0d7ee6fc32

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

# Welcome to Casper
# The friendly cousin of Jasper Reports

# Casper allows you to generate a pdf from a jrxml file, xml data, and a xpath selector

# The compile statement return a string of bytes that can be streammed to file or to
# a browser.

# Example:
#
#  c = Casper.new
#  pdf_data = c.compile open('text.jrxml'), open('data.xml'), '//node', 'pdf'
#  open('mypdf.pdf', 'wb').write pdf_data

# Requirements
# This Gem requires jruby > 1.6.0
require 'java'
# Load Jar and Java Classes
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'poi-3.6.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'commons-digester-1.7.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'commons-logging-1.1.1.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'commons-collections-2.1.1.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'commons-beanutils-1.8.0.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'groovy-all-1.7.5.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'xalan-2.7.1.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'lib', 'iText-2.1.7.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include', 'dist', 'jasperreports-4.0.1.jar')
$CLASSPATH << File.join(File.dirname(__FILE__), '..', 'include')

# Provide a simple class interface to running a jasper report
class CasperReports
  VERSION = '0.1.1'

  def compile(jrxml, data, xpath, type='pdf')
    String.from_java_bytes(Java::XmlDataReportProducer.compile(jrxml, data, xpath, type))
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casperreports-0.1.1 lib/casper_reports.rb