Repository: dotemacs/pdfboxing
Pull request #20 (2016-02-27 14:57:20)

Version 0.1.8
Bump up to 0.1.8


Patch:
diff --git a/README.md b/README.md
index f29aa49..c17f855 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Clojure PDF manipulation library & wrapper for [PDFBox](http://pdfbox.apache.org
 
 ```clojure
 (require '[pdfboxing.merge :as pdf])
-(pdf/merge-pdfs :input ["pdfs/clojure-1.pdf" "pdfs/clojure-2.pdf"] :output "foo.pdf")
+(pdf/merge-pdfs :input ["test/pdfs/clojure-1.pdf" "test/pdfs/clojure-2.pdf"] :output "foo.pdf")
 ```
 
 ### Split a PDF into mutliple PDDocuments
@@ -29,19 +29,19 @@ Clojure PDF manipulation library & wrapper for [PDFBox](http://pdfbox.apache.org
 ```
 List of PDDocument pages 1 through 8
 ```clojure
- (pdf/split-pdf :input "pdfs/clojure.pdf" :start 1 :end 8)
+ (pdf/split-pdf :input "test/pdfs/multi-page.pdf" :start 1 :end 8)
 ```
 Splits the PDF into single pages as a list of PDDocument
 ```clojure
- (pdf/split-pdf :input "pdfs/clojure.pdf")
+ (pdf/split-pdf :input "test/pdfs/multi-page.pdf")
 ```
 Splits the PDF in half and writes them to disk as clojure-1.pdf and clojure-2.pdf
 ```clojure
- (pdf/split-pdf-at :input "pdfs/clojure.pdf")
+ (pdf/split-pdf-at :input "test/pdfs/multi-page.pdf")
 ```
 Splits into two PDFs, the first having 5 pages and second has rest
 ```clojure
- (pdf/split-pdf-at :input "pdfs/clojure.pdf" :split 5)
+ (pdf/split-pdf-at :input "test/pdfs/multi-page.pdf" :split 5)
 ```
 
 ### List form fields of a PDF
@@ -50,7 +50,7 @@ To list fields and values:
 
 ```clojure
 (require '[pdfboxing.form :as form])
-(form/get-fields "pdfs/interactiveform.pdf"))
+(form/get-fields "test/pdfs/interactiveform.pdf"))
 {"Emergency_Phone" "", "ZIP" "", "COLLEGE NO DEGREE" "", ...}
 ```
 ### Fill in PDF forms
@@ -61,7 +61,7 @@ the fields filled in:
 
 ```clojure
 (require '[pdfboxing.form :as form])
-(form/set-fields "pdfs/fillable.pdf" "pdfs/new.pdf" {"Text10" "My first name"})
+(form/set-fields "test/pdfs/fillable.pdf" "test/pdfs/new.pdf" {"Text10" "My first name"})
 ```
 
 ### Rename form fields of a PDF
diff --git a/project.clj b/project.clj
index b26b6ff..02ff947 100644
--- a/project.clj
+++ b/project.clj
@@ -1,4 +1,4 @@
-(defproject pdfboxing "0.1.7"
+(defproject pdfboxing "0.1.8"
   :description "Clojure PDF manipulation library & wrapper for PDFBox"
   :url "https://github.com/dotemacs/pdfboxing"
   :license {:name "BSD"
diff --git a/src/pdfboxing/form.clj b/src/pdfboxing/form.clj
index 8677a9a..78c7098 100644
--- a/src/pdfboxing/form.clj
+++ b/src/pdfboxing/form.clj
@@ -26,6 +26,8 @@
           (doseq [field new-fields]
             (.setValue (.getField form (name (key field))) (val field)))
           (.save doc output))
+        (catch IOException e
+          (str "Error: can't add non-simple fonts, this is a constraint of PDFBox."))
         (catch NullPointerException e
           (str "Error: non existent field provided"))))))
 


Test patch:
diff --git a/test/pdfboxing/form_test.clj b/test/pdfboxing/form_test.clj
index 060a648..3071e92 100644
--- a/test/pdfboxing/form_test.clj
+++ b/test/pdfboxing/form_test.clj
@@ -42,12 +42,12 @@
 
 (deftest populating-fields
   (testing "Error handling for non simple fonts"
-    (is (thrown? java.io.IOException
-                 (set-fields "test/pdfs/interactiveform.pdf"
-                             "test/pdfs/filled-in.pdf"
-                             {"Name_Last" "Last",
-                              "Name_First" "First",
-                              "Name_Middle" "Middle"}))))
+    (is (= "Error: can't add non-simple fonts, this is a constraint of PDFBox."
+           (set-fields "test/pdfs/interactiveform.pdf"
+                       "test/pdfs/filled-in.pdf"
+                       {"Name_Last" "Last",
+                        "Name_First" "First",
+                        "Name_Middle" "Middle"}))))
 
   (testing "Non existent field filling"
     (is (= "Error: non existent field provided"