From be6cc84c9044c250871f5c8521234dce3d0e518a Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 2 Apr 2017 16:54:33 -0400 Subject: [PATCH] add margin preset keywords for more typical choices --- src/clj_htmltopdf/options.clj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/clj_htmltopdf/options.clj b/src/clj_htmltopdf/options.clj index f36dd7e..d1b37c6 100644 --- a/src/clj_htmltopdf/options.clj +++ b/src/clj_htmltopdf/options.clj @@ -68,6 +68,13 @@ [{:keys [margin] :as page-options}] (let [default-margin (get-in default-options [:page :margin])] (cond + (keyword? margin) + (case margin + :normal [[:margin default-margin]] + :narrow [[:margin "0.5in"]] + :moderate [[:margin "1.0in 0.75in"]] + :wide [[:margin "1.0in 2.0in"]]) + (map? margin) [[:margin-left (or (:left margin) default-margin)] [:margin-top (or (:top margin) default-margin)]