Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move go block. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e0e4f7b2a3adfd85c8ccbeb9b15fa532 |
User & Date: | jaccarmac 2019-08-01 18:32:01.150 |
Context
2019-08-01
| ||
18:44 | Sort text on page by x and y coords. check-in: b5d05a4c38 user: jaccarmac tags: trunk | |
18:32 | Move go block. check-in: e0e4f7b2a3 user: jaccarmac tags: trunk | |
18:05 | let -> when-let check-in: 6cffa263b3 user: jaccarmac tags: trunk | |
Changes
Changes to pdf-invoice-extract/src/extract.cljs.
1 2 3 4 5 6 | (ns extract (:require-macros [cljs.core.async.macros :refer [go]]) (:require [cljs.core.async :refer [chan put! <!]] ["pdf.js-extract" :refer [PDFExtract]])) (defn extract [fn] | < | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | (ns extract (:require-macros [cljs.core.async.macros :refer [go]]) (:require [cljs.core.async :refer [chan put! <!]] ["pdf.js-extract" :refer [PDFExtract]])) (defn extract [fn] (let [data-chan (chan)] (.extract (new PDFExtract) fn #js{} #(do (if %1 (println %1) (put! data-chan %2)))) (go (when-let [data (<! data-chan)] ;; the format we need to pull out is after a string content of "ea" ;; table fmt is "ea", name, type, # ordered, # shipped, id, # U/M, total price, retail price, extended price (map #(.-str %) (.-content (first (.-pages data)))))))) (defn main [& cli-args] (go (println (<! (extract (first cli-args)))))) |