Skip to content

Commit

Permalink
made some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarrick committed Dec 17, 2018
1 parent 885fbc6 commit 89e7df7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/clj/clj_pdf/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@
(cond
(= [:pagebreak] item) (.newPage doc)
(= [:clear-double-page] item) (clear-double-page stylesheet references font-style width height item doc pdf-writer)
(= (first item) :pdf-table) (make-section
doc
(assoc font-style
:stylesheet stylesheet
:references references
:left-margin (.leftMargin doc)
:right-margin (.rightMargin doc)
:top-margin (.topMargin doc)
:bottom-margin (.bottomMargin doc)
:page-width width
:page-height height
:pdf-writer pdf-writer)
(or item [:paragraph item]))
:else (.add doc
(make-section
doc
Expand Down
5 changes: 3 additions & 2 deletions src/clj/clj_pdf/section/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
(defmethod render :heading
[_ ^Document doc meta & content]
(apply render :paragraph
doc
(merge meta (merge {:size 18 :style :bold} (:style meta)))
content))

Expand All @@ -101,7 +102,7 @@
(.setOffset lineSeparator -5)
lineSeparator))
([_ ^Document doc meta & _]
(render :line meta)))
(render :line doc meta)))


(defmethod render :list
Expand Down Expand Up @@ -210,7 +211,7 @@


(defmethod render :spacer
([_ ^Document doc meta] (render :spacer meta 1))
([_ ^Document doc meta] (render :spacer doc meta 1))
([_ ^Document doc meta height]
(make-section doc [:paragraph (merge {:leading (:size meta 12)} meta) (apply str (take height (repeat "\n")))])))

Expand Down
4 changes: 2 additions & 2 deletions src/clj/clj_pdf/section/table.clj
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
widths
& rows]

(when (empty? rows)
(throw (new Exception "Table must contain at least one row")))
(comment (when (empty? rows)
(throw (new Exception "Table must contain at least one row"))))
(let [header-size (if (seq header) (count header))
footer-size (if (seq footer) (count footer))
;; with PdfPTable, the header and footer rows need to go first in the list
Expand Down

0 comments on commit 89e7df7

Please sign in to comment.