Created
May 2, 2013 07:46
-
-
Save martintrojer/5500748 to your computer and use it in GitHub Desktop.
Get text from PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns pdftstr.core | |
(:import [com.snowtide.pdf OutputTarget PDFTextStream])) | |
(defn get-text [filename] | |
(with-open [pdfts (PDFTextStream. filename)] | |
(let [txt (StringBuilder. 1024)] | |
(.pipe pdfts (OutputTarget. txt)) | |
(str txt)))) | |
(get-text "kalle.pdf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject pdftstr "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[com.snowtide/pdftextstream "2.6.2"]] | |
:repositories [["snowtide-releases" "http://maven.snowtide.com/releases"]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment