Skip to content

Instantly share code, notes, and snippets.

@ajstarks
Created June 12, 2018 11:30
Show Gist options
  • Save ajstarks/212113f7aaaa6505b977c48e3f3bb1e7 to your computer and use it in GitHub Desktop.
Save ajstarks/212113f7aaaa6505b977c48e3f3bb1e7 to your computer and use it in GitHub Desktop.
pdfgen client
package main
import (
"os"
"github.com/ajstarks/pdfgen"
)
func main() {
xp := []float64{300, 350, 400}
yp := []float64{500, 550, 500}
doc := pdfgen.NewDoc(os.Stdout, 612, 792)
doc.Init(1)
doc.NewPage(1)
doc.Text(120, 396, "hello, PDF", "sans", 72, "rgb(128,0,0)")
doc.Line(200, 600, 400, 600, 5, "black")
doc.Curve(200, 100, 200, 250, 500, 200, 2, "rgb(0,0,128)")
doc.Rect(200, 500, 50, 50, "rgb(255,128,0)")
doc.Polygon(xp, yp, "rgb(128,128,191)")
doc.EndPage()
doc.EndDoc()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment