diff --git a/exporter/src/app/renderer/pdf.cljs b/exporter/src/app/renderer/pdf.cljs index 25e7ff8bcc..95c02a5fc8 100644 --- a/exporter/src/app/renderer/pdf.cljs +++ b/exporter/src/app/renderer/pdf.cljs @@ -42,22 +42,21 @@ (bw/eval! dom (fn [elem] (let [rect (.getBoundingClientRect ^js elem) - width (or (some-> (.getAttribute ^js elem "width") js/parseFloat) 0) - height (or (some-> (.getAttribute ^js elem "height") js/parseFloat) 0) - width (js/Math.max width (.-width rect)) - height (js/Math.max height (.-height rect)) + width (js/Math.max (or (some-> (.getAttribute ^js elem "width") js/parseFloat) 0) + (.-width rect)) + height (js/Math.max (or (some-> (.getAttribute ^js elem "height") js/parseFloat) 0) + (.-height rect)) width-px (str width "px") height-px (str height "px") - head (.-head js/document) - style-id "penpot-pdf-page-size" - style-node (or (.getElementById js/document style-id) - (doto (.createElement js/document "style") - (set! (.-id %) style-id) - (.appendChild head %)))] + style-node (or (.getElementById js/document "penpot-pdf-page-size") + (let [node (.createElement js/document "style")] + (set! (.-id node) "penpot-pdf-page-size") + (.appendChild (.-head js/document) node) + node))] (set! (.-textContent style-node) (str "@page { size: " width-px " " height-px "; margin: 0; }\n" - "html, body, #app { margin: 0; padding: 0; " - "width: " width-px "; height: " height-px "; overflow: visible; }\n")))))) + "html, body, #app { margin: 0; padding: 0;" + "width: " width-px "; height: " height-px "; }")))))) (render-object [page base-uri {:keys [id] :as object}] (p/let [uri (prepare-uri base-uri id)