                                                                (case (:size %)
                                                                  "h1" [:paragraph.generic {:align :left }
                                                                        [:spacer 0]
-                                                                       [:heading (or (:content %) "")]
+                                                                       [:heading  (:content %)]
                                                                        [:line {:dotted true}]
                                                                        ]
                                                                  "h2" [:paragraph.generic {:align :left}
                                                                        [:spacer 1]
-                                                                       [:heading {:style {:size 12 :align :center}}  (or (:content %) "")]
+                                                                       [:heading {:style {:size 12 :align :center}}  (:content %)]
                                                                        [:line {:dotted true}]] ))
 
                                                              (when (= "badge" (:type %))
                                                                [:table {:widths [1 3] :border false :keep-together? false }
+
                                                                 [[:cell {:align :center}
-                                                                  (when-not (blank? (:image_file %))
+                                                                  (if (= "-" (:image_file %))
+                                                                    ""
                                                                     [:paragraph {:align :center :keep-together true}
                                                                      (if (ends-with? (:image_file %) "png")
                                                                        [:paragraph [:chunk [:image {:align :center :width 80 :height 80} (str data-dir "/" (:image_file %))]] [:spacer 1]"\n" ]

                                                                 (into [:table {:border false :widths [1 3] :keep-together? false}]
                                                                       (conj  (into [[[:cell {:colspan 2}]]] (for [badge (:badges %)
                                                                                                                   :let [b (badge-info-fn ctx user-id (conj () (:id badge)))
                                                                                                                         content (first (:content (first b)))]]
                                                                                                               (when-not (empty? b)
                                                                                                                 (conj [[:cell {:align :left} (if (ends-with? (:image_file badge) "png") [:image {:align :center :width 75 :height 75}(str data-dir "/" (:image_file badge))] [:image {:align :center :width 75 :height 75 :base64 true} (:qr_code (first b))])]]
                                                                                                                       [:cell
                                                                                                                        [:paragraph.generic
                                                                                                                         [:heading (:name badge)]
                                                                                                                         [:chunk.bold (str (t :badge/Issuedby ul) ": ")] [:chunk (or (:issuer_content_name content) "-")] "\n"
                                                                                                                         (when-not (blank? (str (:issued_on badge)))
                                                                                                                           [:phrase
                                                                                                                            [:chunk.bold (str (t :badge/Issuedon ul)": ")] [:chunk (date-from-unix-time (long (* 1000 (:issued_on badge))) "date")] "\n"])
                                                                                                                         (or (:description badge) "-") "\n"
                                                                                                                         [:spacer 0]
                                                                                                                         [:paragraph {:keep-together true}
                                                                                                                          [:phrase.bold (str (t :badge/Criteria ul)": ")] "\n"
                                                                                                                          [:anchor {:target (:criteria_url badge) :style{:family :times-roman :color [66 100 162]}} (or (:criteria_url badge) "-")] "\n"
                                                                                                                          (when-not (blank? (:criteria_content content))
                                                                                                                            (markdown->clj-pdf {:spacer {:extra-starting-value 0 :allow-extra-line-breaks? false} :paragraph {:keep-together? true} :wrap {:global-wrapper :paragraph}} (or (:criteria_content content) "-")))
                                                                                                                          ]
                                                                                                                         ][:spacer 0]]))))
                                                                              [[:cell {:colspan 2}[:line {:dotted true}]]]))

                           ))
         ]
    ;; TODO FIX HTML
    (fn [out]
      (pdf/pdf (into [pdf-settings [:spacer 4]]
                     (page-template page)) out))))
