diff options
author | Joop Kiefte <joop@kiefte.net> | 2016-06-03 17:23:31 +0000 |
---|---|---|
committer | Joop Kiefte <joop@kiefte.net> | 2016-06-03 17:23:31 +0000 |
commit | 22fab0a8bc6ae7f468c91ed2835a55226270afad (patch) | |
tree | dfaf7993b11873207ef4edcb25f628ff3d296011 | |
parent | 4ae0d206d6f6d987fa373b6070f76b6e6971d72c (diff) |
Now accepting real files from the standard input
-rw-r--r-- | main.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2,6 +2,8 @@ package main import ( "github.com/jung-kurt/gofpdf" + "io/ioutil" + "os" "strings" ) @@ -105,9 +107,13 @@ func main() { pdf.SetMargins(1, 1, 1) pdf.SetXY(1, 1) f := Tree{PDF: pdf} - f.ParseString(example) + input, err := ioutil.ReadAll(os.Stdin) + if err != nil { + panic(err) + } + f.ParseString(string(input)) f.Render() - err := pdf.OutputFileAndClose("fountain.pdf") + err = pdf.OutputFileAndClose("fountain.pdf") if err != nil { panic(err) } |