         width (:width attrs)
         height (:height attrs)
         s (hiccup.core/html (conj body svg))]
+    (swap! input-height (fn [o] height))
+    (swap! input-width (fn [o] width))
     (bootstrap)
-    (Platform/runLater (fn [] (.setPrefHeight @webview height)))
-    (Platform/runLater (fn [] (.setPrefWidth @webview width)))
+    (Platform/runLater (fn [] (.setZoom @webview @zoom)))
+    (Platform/runLater (fn [] (.setPrefHeight @webview (* @zoom height))))
+    (Platform/runLater (fn [] (.setPrefWidth @webview (* @zoom width))))
     (render-string s)
     (Platform/runLater (fn [] (.sizeToScene @stage)))
     (Platform/runLater (fn [] (.show @stage)))

           (javafx.embed.swing SwingFXUtils)
           (javax.imageio ImageIO)
           (java.io File)
           (javafx.concurrent Worker$State)))

(defonce latch (CountDownLatch. 1))
(defonce webview (atom nil))
(defonce stage (atom nil))
(defonce engine (atom nil))

(defn -start [this internal-stage]
  (.setTitle internal-stage "SVG Output")
  (let [internal-webview (WebView.)
        internal-engine (.getEngine internal-webview)
        layout (VBox. 0.0)
        children (.getChildren layout)]
    (.loadContent internal-engine "about:blank")
    (.setAll children [internal-webview])
    (.setScene internal-stage (Scene. layout))
    (.show internal-stage)
    (swap! engine (fn [x] internal-engine))
    (swap! stage (fn [x] internal-stage))
    (swap! webview (fn [x] internal-webview)))
  (Platform/runLater (fn [] (.countDown latch))))


    (Platform/runLater
      (fn []
        (let [snap (SnapshotParameters.)]
          (.setViewport snap (Rectangle2D. 0 0 (* @zoom width) (* @zoom height)))
          (let [image (.snapshot @webview snap nil)
                bufimage (SwingFXUtils/fromFXImage image nil)]
            (ImageIO/write bufimage "png" (File. filename))))))
    (Platform/runLater (fn [] (.countDown ll)))
    (.await ll)))

