Fixing pdf long invoice lines.
This commit is contained in:
@@ -33,6 +33,22 @@
|
|||||||
(let [sum (reduce + 0 nums)]
|
(let [sum (reduce + 0 nums)]
|
||||||
(map #(* 100 (/ % sum)) nums)))
|
(map #(* 100 (/ % sum)) nums)))
|
||||||
|
|
||||||
|
(defn split-memo [memo]
|
||||||
|
(str/join "\n"
|
||||||
|
(reverse
|
||||||
|
(take 6
|
||||||
|
(concat
|
||||||
|
(reduce
|
||||||
|
(fn [[line & rest ] word]
|
||||||
|
(let [line (or line "")]
|
||||||
|
(if (> (+ (count line) (count word)) 50)
|
||||||
|
(concat [word line] rest)
|
||||||
|
(concat [(str line " " word)]
|
||||||
|
rest))))
|
||||||
|
[]
|
||||||
|
(str/split memo #" "))
|
||||||
|
(repeat ""))))))
|
||||||
|
|
||||||
(defn make-check-pdf [check]
|
(defn make-check-pdf [check]
|
||||||
(let [output-stream (ByteArrayOutputStream.)]
|
(let [output-stream (ByteArrayOutputStream.)]
|
||||||
(pdf/pdf
|
(pdf/pdf
|
||||||
@@ -73,15 +89,17 @@
|
|||||||
[:cell {:colspan 3}]]
|
[:cell {:colspan 3}]]
|
||||||
|
|
||||||
|
|
||||||
[[:cell {:colspan 6 :leading 50} [:spacer]]
|
[[:cell {:size 9 :leading 11.5} "\n\n\n\n\nMEMO"]
|
||||||
[:cell {:colspan 6 :rowspan 2} (if (:signature-file company)
|
[:cell {:colspan 5 :leading 11.5} (split-memo memo)
|
||||||
|
[:line {:line-width 0.15 :color [50 50 50]}]]
|
||||||
|
[:cell {:colspan 6 } (if (:signature-file company)
|
||||||
[:image { :top-margin 90 :xscale 0.30 :yscale 0.30 :align :center}
|
[:image { :top-margin 90 :xscale 0.30 :yscale 0.30 :align :center}
|
||||||
|
|
||||||
(:signature-file company)]
|
(:signature-file company)]
|
||||||
[:spacer])]]
|
[:spacer])]]
|
||||||
|
|
||||||
[[:cell {:size 9 } "MEMO"]
|
#_[
|
||||||
[:cell {:colspan 5} memo [:line {:line-width 0.15 :color [50 50 50]}]]
|
#_[:cell {:colspan 5} #_memo ]
|
||||||
#_[:cell {:colspan 6}]]
|
#_[:cell {:colspan 6}]]
|
||||||
|
|
||||||
[[:cell {:colspan 2}]
|
[[:cell {:colspan 2}]
|
||||||
|
|||||||
Reference in New Issue
Block a user