diff --git a/project.clj b/project.clj index 6237baa..5927a30 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject clj-pdf "2.3.9" +(defproject clj-pdf "2.4.0" :description "PDF generation library" :url "https://github.com/yogthos/clj-pdf" diff --git a/src/clj/clj_pdf/section.clj b/src/clj/clj_pdf/section.clj index 56408f5..cc10c79 100644 --- a/src/clj/clj_pdf/section.clj +++ b/src/clj/clj_pdf/section.clj @@ -45,7 +45,7 @@ (apply render tag new-meta elements))) (catch Exception e - (prn meta element) + #_(prn meta element) (throw (ex-info "failed to parse element" {:meta meta :element element} e)))))) diff --git a/src/clj/clj_pdf/section/core.clj b/src/clj/clj_pdf/section/core.clj index a9c0c97..8486000 100644 --- a/src/clj/clj_pdf/section/core.clj +++ b/src/clj/clj_pdf/section/core.clj @@ -58,8 +58,8 @@ (.setBackground element color))) -(defn- text-chunk [style content] - (let [ch (Chunk. ^String (make-section content) ^Font (font style))] +(defn- text-chunk [style ^String content] + (let [ch (Chunk. ^String content ^Font (font style))] (set-background ch style) (cond (:super style) (.setTextRise ch (float 5)) @@ -69,8 +69,8 @@ (defn- format-content [meta content] (cond - (string? content) (Chunk. ^String content ^Font (font meta)) - (number? content) (Chunk. ^String (str content) ^Font (font meta)) + (string? content) (text-chunk meta content) + (number? content) (text-chunk meta (str content)) :else content)) @@ -80,7 +80,7 @@ (cond (instance? Image children) (image-chunk meta children) (instance? Chunk children) children - :else (text-chunk meta children)))) + :else (format-content meta children)))) (defmethod render :graphics diff --git a/test/anchor.pdf b/test/anchor.pdf index 3776912..31e4a30 100644 Binary files a/test/anchor.pdf and b/test/anchor.pdf differ diff --git a/test/base64image.pdf b/test/base64image.pdf index d06f8c1..236a284 100644 Binary files a/test/base64image.pdf and b/test/base64image.pdf differ diff --git a/test/chapter.pdf b/test/chapter.pdf index a69cf79..364fa37 100644 Binary files a/test/chapter.pdf and b/test/chapter.pdf differ diff --git a/test/chunk.pdf b/test/chunk.pdf index 44fc59c..83a717f 100644 Binary files a/test/chunk.pdf and b/test/chunk.pdf differ diff --git a/test/clj_pdf/test/example.clj b/test/clj_pdf/test/example.clj index 46cb595..becc4c2 100644 --- a/test/clj_pdf/test/example.clj +++ b/test/clj_pdf/test/example.clj @@ -578,3 +578,9 @@ "STYLED"] [:chunk "UNSTYLEs"]] "font-test.pdf") + +#_(pdf + [{} + [:chunk 123] + [:chunk {:color [255 0 0] :background [0 255 0]} "Text with green background"]] + "doc.pdf") diff --git a/test/header.pdf b/test/header.pdf index bc6940c..15f25a3 100644 Binary files a/test/header.pdf and b/test/header.pdf differ diff --git a/test/heading.pdf b/test/heading.pdf index 9205e7a..66f29c6 100644 Binary files a/test/heading.pdf and b/test/heading.pdf differ diff --git a/test/image.pdf b/test/image.pdf index 282b8b4..46b4619 100644 Binary files a/test/image.pdf and b/test/image.pdf differ diff --git a/test/image1.pdf b/test/image1.pdf index fd683e2..ad656e6 100644 Binary files a/test/image1.pdf and b/test/image1.pdf differ diff --git a/test/image2.pdf b/test/image2.pdf index 3e29344..5311e77 100644 Binary files a/test/image2.pdf and b/test/image2.pdf differ diff --git a/test/line.pdf b/test/line.pdf index e981cce..157a4bb 100644 Binary files a/test/line.pdf and b/test/line.pdf differ diff --git a/test/list.pdf b/test/list.pdf index 109d65f..831015e 100644 Binary files a/test/list.pdf and b/test/list.pdf differ diff --git a/test/nil.pdf b/test/nil.pdf index 44276a4..f72c4a1 100644 Binary files a/test/nil.pdf and b/test/nil.pdf differ diff --git a/test/nofooter.pdf b/test/nofooter.pdf index 52f76fa..bdb31f7 100644 Binary files a/test/nofooter.pdf and b/test/nofooter.pdf differ diff --git a/test/pages1.pdf b/test/pages1.pdf index 5e2ed84..15322f5 100644 Binary files a/test/pages1.pdf and b/test/pages1.pdf differ diff --git a/test/pages2.pdf b/test/pages2.pdf index 581b465..d683bc9 100644 Binary files a/test/pages2.pdf and b/test/pages2.pdf differ diff --git a/test/paragraph.pdf b/test/paragraph.pdf index a173aa5..4709fe7 100644 Binary files a/test/paragraph.pdf and b/test/paragraph.pdf differ diff --git a/test/phrase.pdf b/test/phrase.pdf index e584584..05af7ec 100644 Binary files a/test/phrase.pdf and b/test/phrase.pdf differ diff --git a/test/section.pdf b/test/section.pdf index 346cbaa..8497228 100644 Binary files a/test/section.pdf and b/test/section.pdf differ diff --git a/test/spacer.pdf b/test/spacer.pdf index f96e98b..3791599 100644 Binary files a/test/spacer.pdf and b/test/spacer.pdf differ diff --git a/test/subsuper.pdf b/test/subsuper.pdf index 20c73e7..c71e674 100644 Binary files a/test/subsuper.pdf and b/test/subsuper.pdf differ diff --git a/test/table.pdf b/test/table.pdf index e9baf2f..e096464 100644 Binary files a/test/table.pdf and b/test/table.pdf differ