 (defn svg-to-pdf [svg pdf-size landscape x y]
   (try
     (with-open [out (new ByteArrayOutputStream)]
-      (pdf [{:size pdf-size :orientation (if landscape :landscape nil)} [:svg {:translate [x y]} (remove-cursor (trim-svg-string svg))]] out)
+      (pdf [{:size pdf-size :orientation (if landscape :landscape nil)}
+            [:svg {:translate [x y]} (clear-svg (remove-cursor (trim-svg-string svg)))]]
+           out)
       {:ok true :result (.toByteArray out)})
     (catch Exception e {:ok false :result (.getMessage e)})))
 

(defn svg-to-png [svg widht height force-transparent-white]
  (try
    (with-open [out (new ByteArrayOutputStream)]
      (let [svg (remove-cursor svg)
            string-reader (new StringReader svg)
            transcoder-input (new TranscoderInput string-reader)
            transcoder-output (new TranscoderOutput out)
            transcoder (new PNGTranscoder)]

        (.addTranscodingHint transcoder JPEGTranscoder/KEY_WIDTH (float widht))
        (.addTranscodingHint transcoder JPEGTranscoder/KEY_HEIGHT (float height))
        (.addTranscodingHint transcoder JPEGTranscoder/KEY_FORCE_TRANSPARENT_WHITE (boolean force-transparent-white))
        (.transcode transcoder transcoder-input transcoder-output)
        {:ok true :result (.toByteArray out)}
        ))
    (catch Exception e {:ok false :result (.getMessage e)})))

;====================================================================================

(defn svg-to-jpg [svg widht height force-transparent-white quality]
  (try
    (with-open [out (new ByteArrayOutputStream)]
      (let [svg (remove-empty-img (remove-cursor svg))
            string-reader (new StringReader svg)
            transcoder-input (new TranscoderInput string-reader)
            transcoder-output (new TranscoderOutput out)
