Skip to content

Instantly share code, notes, and snippets.

@orb orb/jaspertest-core.clj
Last active Aug 29, 2015

Embed
What would you like to do?
jasper clojure
(ns jaspertest.core
(:import [net.sf.jasperreports.engine JasperFillManager JasperExportManager JasperCompileManager])
(:require [clojure.java.io :as io]))
(defn java-hashmap [results-map]
(let [hashmap-reducer (fn [m [k v]] (doto m (.put (name k) v)))]
(reduce hashmap-reducer (java.util.HashMap.) results-map)))
(def mock-data
(java-hashmap {:id 42 :name "Some Company" :project_number 99876}))
(defn call-jasper-map []
(JasperCompileManager/compileReportToFile "test.jrxml" "test.jasper")
(JasperFillManager/fillReportToFile "test.jasper" "test.out" mock-data)
(JasperExportManager/exportReportToPdfFile "test.out" "test.pdf"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.