Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created August 6, 2012 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattdeboard/1b4a85042d3185f4c625 to your computer and use it in GitHub Desktop.
Save mattdeboard/1b4a85042d3185f4c625 to your computer and use it in GitHub Desktop.
;; Throws NPE
(with-open [doc (doto (new Document) (.open))
os (clojure.java.io/output-stream "resources/foo2.pdf")]
(let [pw (PdfWriter/getInstance doc os)]
(. pw open)
pw))
;; Works great
(with-open [os (clojure.java.io/output-stream "resources/foo2.pdf")]
(let [doc (doto (new Document) (.open))
pw (PdfWriter/getInstance doc os)]
(. pw open)
pw))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment