[[org.clojure/data.csv "1.0.0"] | [[org.clojure/data.csv "1.0.0"] | ||||
[me.raynes/fs "1.4.6"] | [me.raynes/fs "1.4.6"] | ||||
[org.clojure/tools.logging "1.1.0"] | [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"]] | :plugins [[lein-codox "0.10.7"]] | ||||
{:provided | {:provided | ||||
{:dependencies | {:dependencies | ||||
[[org.clojure/clojure "1.10.1"] | [[org.clojure/clojure "1.10.1"] | ||||
[org.clojars.yjcyxky/tservice "0.5.8"]]} | |||||
[org.clojars.yjcyxky/tservice "0.6.0"]]} | |||||
:uberjar | :uberjar | ||||
{:auto-clean true | {:auto-clean true |
# This is a test |
display-name: XPS to PDF | display-name: XPS to PDF | ||||
lazy-load: false | lazy-load: false | ||||
init: | init: | ||||
- step: unpack-env | |||||
envname: config | |||||
envtype: 'configuration' | |||||
- step: unpack-env | - step: unpack-env | ||||
envname: xps2pdf | envname: xps2pdf | ||||
- step: load-namespace | - step: load-namespace |
(make-plugin-metadata | (make-plugin-metadata | ||||
{:name "xps2pdf" | {:name "xps2pdf" | ||||
:params-schema xps2pdf-params-body | :params-schema xps2pdf-params-body | ||||
:handler (fn [{:keys [filepath]}] | |||||
:handler (fn [{:keys [filepath plugin-env]}] | |||||
(let [tservice-workdir (get-tservice-workdir) | (let [tservice-workdir (get-tservice-workdir) | ||||
from-path (if (re-matches #"^file:\/\/\/.*" filepath) | from-path (if (re-matches #"^file:\/\/\/.*" filepath) | ||||
; Absolute path with file:// | ; Absolute path with file:// | ||||
pdf-path (fs-lib/join-paths to-dir "merged.pdf")] | pdf-path (fs-lib/join-paths to-dir "merged.pdf")] | ||||
(doall (pmap #(xps2pdf! %1 %2) from-files to-files)) | (doall (pmap #(xps2pdf! %1 %2) from-files to-files)) | ||||
(fs-lib/zip-files to-files zip-path) | (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 ---------------------------------------------------- | ;;; --------------------------------------------------- Lifecycle ---------------------------------------------------- | ||||
(:require [clojure.java.shell :as shell] | (:require [clojure.java.shell :as shell] | ||||
[tservice.lib.files :refer [get-plugin-dir get-path-variable]] | [tservice.lib.files :refer [get-plugin-dir get-path-variable]] | ||||
[tservice.lib.fs :as fs] | [tservice.lib.fs :as fs] | ||||
[pdfboxing.merge :as pdf] | |||||
[clojure.tools.logging :as log] | [clojure.tools.logging :as log] | ||||
[clojure.string :as str])) | [clojure.string :as str])) | ||||
"Dispatch to different function." | "Dispatch to different function." | ||||
[{:keys [input output type]}] | [{:keys [input output type]}] | ||||
(println "Convert XPS to" (str/upper-case type) ":" input) | (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)) |