summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2016-06-03 08:56:38 +0200
committerJoop Kiefte <ikojba@gmail.com>2016-06-03 08:56:38 +0200
commitff6c9ff65dfc8fed4b5420278c99db2c73351f61 (patch)
treee2da7dcdeacc74e01e9f90023f76ee7478115efe
Initial commit
-rw-r--r--main.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..c1f5211
--- /dev/null
+++ b/main.go
@@ -0,0 +1,33 @@
+package main
+
+import "github.com/jung-kurt/gofpdf"
+
+var tr func(string) string
+
+func line(pdf *gofpdf.Fpdf, jump, width float64, text string) {
+ pdf.SetX(jump)
+ pdf.MultiCell(width, 0.19, tr(text), "", "aligned", false)
+}
+
+func main() {
+ pdf := gofpdf.New("P", "in", "Letter", "")
+ tr = pdf.UnicodeTranslatorFromDescriptor("")
+ pdf.AddPage()
+ pdf.SetFont("courier", "", 12)
+ pdf.SetMargins(1, 1, 1)
+ pdf.SetXY(1, 1)
+ line(pdf, 1.5, 6, "FADE IN")
+ line(pdf, 1.5, 6, "")
+ line(pdf, 1.5, 6, "A RIVER")
+ line(pdf, 1.5, 6, "")
+ line(pdf, 1.5, 6, "We’re underwater, watching a fat catfish swim along.")
+ line(pdf, 1.5, 6, "")
+ line(pdf, 1.5, 6, "This is The Beast.")
+ line(pdf, 1.5, 6, "")
+ line(pdf, 4.2, 3.3, "EDWARD (V.O.)")
+ line(pdf, 2.9, 3.3, "There are some fish that cannot be caught. It’s not that they’re faster or stronger than other fish. They’re just touched by something extra. Call it luck. Call it grace. One such fish was The Beast.")
+ err := pdf.OutputFileAndClose("hello.pdf")
+ if err != nil {
+ panic(err)
+ }
+}