From 6f3f2f9a7198aaf5515688ad124645803ee44c1d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 6 Feb 2026 11:19:56 +0100 Subject: [PATCH] :bug: Fix issue with pdf render on exporter When paired with release build penpot app --- exporter/src/app/renderer/pdf.cljs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exporter/src/app/renderer/pdf.cljs b/exporter/src/app/renderer/pdf.cljs index a93020e147..25bcfc036b 100644 --- a/exporter/src/app/renderer/pdf.cljs +++ b/exporter/src/app/renderer/pdf.cljs @@ -41,14 +41,20 @@ (sync-page-size! [dom] (bw/eval! dom (fn [elem] + ;; IMPORTANT: No CLJS runtime allowed. Use only JS + ;; primitives. This runs in a context without access to + ;; cljs.core. Avoid any functions that transpile to + ;; cljs.core/* calls, as they will break in the browser + ;; runtime. + (let [width (.getAttribute ^js elem "width") height (.getAttribute ^js elem "height") style-node (let [node (.createElement js/document "style")] (.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; }")))))) + (dm/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; }")))))) (render-object [page base-uri {:keys [id] :as object}] (p/let [uri (prepare-uri base-uri id)