diff --git a/src/clj_htmltopdf/core.clj b/src/clj_htmltopdf/core.clj
index 5bc11da..e9720f5 100644
--- a/src/clj_htmltopdf/core.clj
+++ b/src/clj_htmltopdf/core.clj
@@ -41,6 +41,8 @@
(let [html (read-html-string in)
html-doc (Jsoup/parse html)]
(o/inject-options-into-html! html-doc options)
+ (if (get-in options [:debug :display-html?])
+ (println (str html-doc)))
html-doc))
(defn write-pdf!
@@ -55,7 +57,7 @@
(defn ->pdf
[in out & [options]]
- (let [options (merge o/default-options options)
+ (let [options (o/get-final-options options)
html-doc (prepare-html in options)]
(configure-logging! options)
(write-pdf! html-doc (o/->base-uri options) out)))
diff --git a/src/clj_htmltopdf/options.clj b/src/clj_htmltopdf/options.clj
index e09b758..5d693d1 100644
--- a/src/clj_htmltopdf/options.clj
+++ b/src/clj_htmltopdf/options.clj
@@ -15,6 +15,13 @@
:orientation :portrait
:margin "1.0in"}})
+(defn get-final-options
+ [options]
+ (let [final-options (merge default-options options)]
+ (if (get-in final-options [:debug :display-options?])
+ (clojure.pprint/pprint final-options))
+ final-options))
+
(defn ->base-uri
[options]
(str (:base-uri options)))