|
@@ -22,9 +22,9 @@ var funcmap = template.FuncMap{
|
|
|
}
|
|
|
|
|
|
func convertPDFToPNG(filename string) error {
|
|
|
- out, err := exec.Command("pandoc", pandoc_args...).CombinedOutput()
|
|
|
+ out, err := exec.Command("pdftoppm", filename, "./data/screen", "-png").CombinedOutput()
|
|
|
if string(out) != "" {
|
|
|
- return fmt.Errorf("pandoc: %s", string(out))
|
|
|
+ return fmt.Errorf("pdftoppm: %s", string(out))
|
|
|
}
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -33,7 +33,7 @@ func convertPDFToPNG(filename string) error {
|
|
|
}
|
|
|
|
|
|
func serveScreen(res http.ResponseWriter, req *http.Request) {
|
|
|
- tpl, err := tplutil.LoadTextTemplate("screen.tpl.md", funcmap)
|
|
|
+ tpl, err := tplutil.LoadTextTemplate("./data/screen.tpl.md", funcmap)
|
|
|
if err != nil {
|
|
|
panic(err)
|
|
|
}
|
|
@@ -55,8 +55,14 @@ func serveScreen(res http.ResponseWriter, req *http.Request) {
|
|
|
panic(err)
|
|
|
}
|
|
|
|
|
|
+ log.Println("Converting pdf to png.")
|
|
|
+ err = convertPDFToPNG("./data/screen.pdf")
|
|
|
+ if err != nil {
|
|
|
+ panic(err)
|
|
|
+ }
|
|
|
+
|
|
|
log.Println("Serving screen.png...")
|
|
|
- http.ServeFile(res, req, "./data/screen.png")
|
|
|
+ http.ServeFile(res, req, "./data/screen-1.png")
|
|
|
}
|
|
|
|
|
|
func main() {
|