summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <joop@kiefte.net>2016-06-03 17:23:31 +0000
committerJoop Kiefte <joop@kiefte.net>2016-06-03 17:23:31 +0000
commit22fab0a8bc6ae7f468c91ed2835a55226270afad (patch)
treedfaf7993b11873207ef4edcb25f628ff3d296011
parent4ae0d206d6f6d987fa373b6070f76b6e6971d72c (diff)
Now accepting real files from the standard input
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.go b/main.go
index 25a1de9..b020d42 100644
--- a/main.go
+++ b/main.go
@@ -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)
}