Clojure PDF manipulation library & wrapper for PDFBox.
(require '[pdfboxing.text :as text])
(text/extract "test/pdfs/hello.pdf")
(require '[pdfboxing.merge :as pdf])
(pdf/merge-pdfs :input ["pdfs/clojure-1.pdf" "pdfs/clojure-2.pdf"] :output "foo.pdf")
(require '[pdfboxing.split :as pdf])
List of PDDocument pages 1 through 8
(pdf/split-pdf :input "pdfs/clojure.pdf" :start 1 :end 8)
Splits the PDF into single pages as a list of PDDocument
(pdf/split-pdf :input "pdfs/clojure.pdf")
Splits the PDF in half and writes them to disk as clojure-1.pdf and clojure-2.pdf
(pdf/split-pdf-at :input "pdfs/clojure.pdf")
Splits into two PDFs, the first having 5 pages and second has rest
(pdf/split-pdf-at :input "pdfs/clojure.pdf" :split 5)
To list fields and values:
(require '[pdfboxing.form :as form])
(form/get-fields "pdfs/interactiveform.pdf"))
{"Emergency_Phone" "", "ZIP" "", "COLLEGE NO DEGREE" "", ...}
To fill in form's field supply a hash map with field names and desired values. It will create a copy of fillable.pdf as new.pdf with the fields filled in:
(require '[pdfboxing.form :as form])
(form/set-fields "pdfs/fillable.pdf" "pdfs/new.pdf" {"Text10" "My first name"})
To rename PDF form fields, supply a hash map where the keys are the current names and the values new names:
(require '[pdfboxing.form :as form])
(form/rename-fields "test/pdfs/interactiveform.pdf" "test/pdfs/addr1.pdf" {"Address_1" "NewAddr"})
(require '[pdfboxing.info :as info])
(info/page-number "test/pdfs/interactiveform.pdf")
Such as title, author, subject, keywords, creator & producer
(require '[pdfboxing.info :as info])
(info/about-doc "test/pdfs/interactiveform.pdf")
Supply a PDF document, a name for the output PDF document, the coordinates where the line should be drawn along with the page number on which the line should be drawn
(require '[pdfboxing.draw :as draw])
(draw/draw-line :input-pdf "test/pdfs/clojure-1.pdf"
:output-pdf "ninja.pdf"
:coordinates {:page-number 0
:x 0
:y 160
:x1 650
:y1 160})