From a74fdd5ae6c345686ab75be4db14496ac6e5f3a5 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 1 Apr 2017 15:23:02 -0400 Subject: [PATCH] add default-options --- src/clj_htmltopdf/core.clj | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/clj_htmltopdf/core.clj b/src/clj_htmltopdf/core.clj index 4f7887a..2fda5a7 100644 --- a/src/clj_htmltopdf/core.clj +++ b/src/clj_htmltopdf/core.clj @@ -37,10 +37,18 @@ (catch Exception ex (throw (Exception. "Error parsing input as HTML5." ex))))) +(def default-options + {:logging? false + :base-uri "" + :include-base-css? true + :page {:size :letter + :orientation :portrait}}) + (defn ->pdf [in out & [options]] - (let [builder (PdfRendererBuilder.) - base-uri (str (or (:base-uri options) ".")) + (let [options (merge default-options options) + builder (PdfRendererBuilder.) + base-uri (str (:base-uri options)) html (read-html in) html-doc (parse-html5 html) output (->output-stream out)]