add default-options
This commit is contained in:
parent
631e5fc1a4
commit
a74fdd5ae6
|
@ -37,10 +37,18 @@
|
||||||
(catch Exception ex
|
(catch Exception ex
|
||||||
(throw (Exception. "Error parsing input as HTML5." 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
|
(defn ->pdf
|
||||||
[in out & [options]]
|
[in out & [options]]
|
||||||
(let [builder (PdfRendererBuilder.)
|
(let [options (merge default-options options)
|
||||||
base-uri (str (or (:base-uri options) "."))
|
builder (PdfRendererBuilder.)
|
||||||
|
base-uri (str (:base-uri options))
|
||||||
html (read-html in)
|
html (read-html in)
|
||||||
html-doc (parse-html5 html)
|
html-doc (parse-html5 html)
|
||||||
output (->output-stream out)]
|
output (->output-stream out)]
|
||||||
|
|
Loading…
Reference in a new issue