Liking cljdoc? Tell your friends :D

clj-jasper

A Clojure library to work with Jasper Reports

clj jasper

Usage

Add the following to your Leiningen’s project.clj:

project.clj
[net.tbt-post/clj-jasper "0.0.3"]
example.clj
(ns my-app.jasper
  (:require [clj-jasper.core :as jc]
            [clojure.java.io :as io]))

(defn render [name data]
  (binding [jc/*jr-templates-path* "my-templates"]
    (let [out (jc/data->report {:name     (format "my-reports/%s" name)
                                :data     [data]
                                :filename name})]
      {:status  200
       :headers {"Content-Type"        (:type out)
                 "Content-Disposition" (format "attachment; filename=\"%s\"" (:name out))
                 "Cache-Control"       "no-cache"}
       :body    (-> out :file io/input-stream)})))

License

Copyright © 2018 AI a.k.a. MelKori

Distributed under the MIT License.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close