Exemple #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 := pdfread.Load(os.Args[1])
	if pd == nil {
		complain("Could not load pdf file!\n\n")
	}
	fmt.Printf("%s", svg.Page(pd, page))
}
Exemple #2
0
// hello world, the web server
func HelloServer(c *http.Conn, req *http.Request) {
	c.SetHeader("Content-Type", "image/svg+xml; charset=utf-8")
	page := strm.Int(req.URL.RawQuery, 1) - 1
	io.WriteString(c, string(svg.Page(pd, page)))
}