@@ -13,21 +13,20 @@ import (
13
13
)
14
14
15
15
var size , margin string
16
- var scaleH , scaleW bool
16
+ var scaleH , scaleW , verbose bool
17
17
18
18
const (
19
19
DefaultSize = "IMG-SIZE"
20
20
DefaultMargin = "1,1,1,1"
21
21
)
22
22
23
23
func init () {
24
- // Debug log level.
25
- unicommon .SetLogger (unicommon .NewConsoleLogger (unicommon .LogLevelDebug ))
26
24
27
25
flag .StringVarP (& size , "size" , "s" , DefaultSize , "Resize image pages to print size. One of A4, A3, Legal or Letter." )
28
26
flag .StringVarP (& margin , "margin" , "m" , DefaultMargin , "Comma separated numbers for left, right, top, bottm side margin in inch." )
29
27
flag .BoolVarP (& scaleW , "scale-width" , "w" , false , "Scale Image to page width. Only if --size specified." )
30
28
flag .BoolVarP (& scaleH , "scale-height" , "h" , false , "Scale Image to page height. Only if --size specified." )
29
+ flag .BoolVarP (& verbose , "verbose" , "v" , false , "Display debug info." )
31
30
32
31
flag .Usage = func () {
33
32
fmt .Println ("Requires at least 3 arguments: output_path and 2 input paths (and optional page numbers)" )
@@ -44,6 +43,10 @@ func main() {
44
43
os .Exit (0 )
45
44
}
46
45
46
+ if verbose {
47
+ unicommon .SetLogger (unicommon .NewConsoleLogger (unicommon .LogLevelDebug ))
48
+ }
49
+
47
50
outputPath := args [0 ]
48
51
inputPaths := []string {}
49
52
inputPages := [][]int {}
@@ -79,7 +82,7 @@ func main() {
79
82
os .Exit (1 )
80
83
}
81
84
82
- fmt .Printf ("Complete, see output file: %s\n " , outputPath )
85
+ debugInfo ( fmt .Sprintf ("Complete, see output file: %s" , outputPath ) )
83
86
}
84
87
85
88
func mergePdf (inputPaths []string , inputPages [][]int , outputPath string ) error {
@@ -105,10 +108,6 @@ func mergePdf(inputPaths []string, inputPages [][]int, outputPath string) error
105
108
err = addPdfPages (f , inputPages [i ], c )
106
109
} else if fileType [:6 ] == "image/" {
107
110
err = addImage (inputPath , c )
108
-
109
- fmt .Println ("%+v" , pageMargin )
110
- fmt .Println ("%+v" , pageSize )
111
-
112
111
} else {
113
112
err = errors .New ("Unsupported type:" + inputPath )
114
113
}
0 commit comments