-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (35 loc) · 781 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//go:build ignore
package main
import (
"log"
"os"
"github.com/wuyq101/pdf"
)
func init() {
// set log format
flags := log.Default().Flags() | log.Lshortfile
log.Default().SetFlags(flags)
}
func main() {
/*
f, err := pdf.ReadFromFile("./test-data/test.pdf")
if err != nil {
panic(err)
}
log.Default().Printf("read pdf file: %v\n", f.Header)
// f.ExportJPEG()
f.SaveFile("./test-data/cf-test.pdf", true)
*/
f, err := pdf.ReadFromFile("./test-data/test1.pdf")
if err != nil {
panic(err)
}
log.Default().Printf("read pdf file: %v\n", f.Header)
// f.ExportJPEG()
f.SaveFile("./test-data/cf-test1.pdf", true)
testTIFF()
}
func testTIFF() {
buf, _ := os.ReadFile("./test-data/golang-gopher.tiff")
log.Default().Printf("first 200 %v", buf[:500])
}