@@ -10,8 +10,7 @@ | |||
[[org.clojure/data.csv "1.0.0"] | |||
[me.raynes/fs "1.4.6"] | |||
[org.clojure/tools.logging "1.1.0"] | |||
[org.clojure/core.async "0.4.500" | |||
:exclusions [org.clojure/tools.reader]]] | |||
[pdfboxing/pdfboxing "0.1.14"]] | |||
:plugins [[lein-codox "0.10.7"]] | |||
@@ -22,7 +21,7 @@ | |||
{:provided | |||
{:dependencies | |||
[[org.clojure/clojure "1.10.1"] | |||
[org.clojars.yjcyxky/tservice "0.5.8"]]} | |||
[org.clojars.yjcyxky/tservice "0.6.0"]]} | |||
:uberjar | |||
{:auto-clean true |
@@ -0,0 +1 @@ | |||
# This is a test |
@@ -16,6 +16,9 @@ plugin: | |||
display-name: XPS to PDF | |||
lazy-load: false | |||
init: | |||
- step: unpack-env | |||
envname: config | |||
envtype: 'configuration' | |||
- step: unpack-env | |||
envname: xps2pdf | |||
- step: load-namespace |
@@ -46,7 +46,7 @@ | |||
(make-plugin-metadata | |||
{:name "xps2pdf" | |||
:params-schema xps2pdf-params-body | |||
:handler (fn [{:keys [filepath]}] | |||
:handler (fn [{:keys [filepath plugin-env]}] | |||
(let [tservice-workdir (get-tservice-workdir) | |||
from-path (if (re-matches #"^file:\/\/\/.*" filepath) | |||
; Absolute path with file:// | |||
@@ -89,7 +89,7 @@ | |||
pdf-path (fs-lib/join-paths to-dir "merged.pdf")] | |||
(doall (pmap #(xps2pdf! %1 %2) from-files to-files)) | |||
(fs-lib/zip-files to-files zip-path) | |||
(fs-lib/merge-pdf-files to-files pdf-path))) | |||
(xps-lib/merge-pdf-files to-files pdf-path))) | |||
;;; --------------------------------------------------- Lifecycle ---------------------------------------------------- | |||
@@ -3,6 +3,7 @@ | |||
(:require [clojure.java.shell :as shell] | |||
[tservice.lib.files :refer [get-plugin-dir get-path-variable]] | |||
[tservice.lib.fs :as fs] | |||
[pdfboxing.merge :as pdf] | |||
[clojure.tools.logging :as log] | |||
[clojure.string :as str])) | |||
@@ -73,4 +74,8 @@ | |||
"Dispatch to different function." | |||
[{:keys [input output type]}] | |||
(println "Convert XPS to" (str/upper-case type) ":" input) | |||
(((keyword type) command-map) input output)) | |||
(((keyword type) command-map) input output)) | |||
(defn merge-pdf-files | |||
[from-files to-filepath] | |||
(pdf/merge-pdfs :input from-files :output to-filepath)) |