Esempio n. 1
0
func main() {
	if len(os.Args) == 1 || len(os.Args) > 3 {
		complain("")
	}
	page := 0
	if len(os.Args) > 2 {
		page = strm.Int(os.Args[2], 1) - 1
		if page < 0 {
			complain("Bad page!\n\n")
		}
	}
	pd := pdfreader.Load(os.Args[1])
	if pd == nil {
		complain("Could not load pdf file!\n\n")
	}
	fmt.Printf("%s", svg.Page(pd, page))
}
Esempio n. 2
0
// hello world, the web server
func HelloServer(w http.ResponseWriter, req *http.Request) {
	w.Header().Add("Content-Type", "image/svg+xml; charset=utf-8")
	page := strm.Int(req.URL.RawQuery, 1) - 1
	io.WriteString(w, string(svg.Page(pd, page)))
}