@@ -231,7 +231,7 @@ func processOptimizeCommand(conf *model.Configuration) {
231
231
process (cli .OptimizeCommand (inFile , outFile , conf ))
232
232
}
233
233
234
- func processSplitVyPageNumberCommand (inFile , outDir string , conf * model.Configuration ) {
234
+ func processSplitByPageNumberCommand (inFile , outDir string , conf * model.Configuration ) {
235
235
if len (flag .Args ()) == 2 {
236
236
fmt .Fprintln (os .Stderr , "split: missing page numbers" )
237
237
os .Exit (1 )
@@ -274,7 +274,7 @@ func processSplitCommand(conf *model.Configuration) {
274
274
outDir := flag .Arg (1 )
275
275
276
276
if mode == "page" {
277
- processSplitVyPageNumberCommand (inFile , outDir , conf )
277
+ processSplitByPageNumberCommand (inFile , outDir , conf )
278
278
return
279
279
}
280
280
@@ -666,24 +666,7 @@ func isHex(s string) bool {
666
666
return err == nil
667
667
}
668
668
669
- func processSetPermissionsCommand (conf * model.Configuration ) {
670
- if perm != "" {
671
- perm = permCompletion (perm )
672
- }
673
- if len (flag .Args ()) != 1 || selectedPages != "" {
674
- fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePermSet )
675
- os .Exit (1 )
676
- }
677
- if perm != "" && perm != "none" && perm != "print" && perm != "all" && ! isBinary (perm ) && ! isHex (perm ) {
678
- fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePermSet )
679
- os .Exit (1 )
680
- }
681
-
682
- inFile := flag .Arg (0 )
683
- if conf .CheckFileNameExt {
684
- ensurePDFExtension (inFile )
685
- }
686
-
669
+ func configPerm (perm string , conf * model.Configuration ) {
687
670
if perm != "" {
688
671
switch perm {
689
672
case "none" :
@@ -702,6 +685,27 @@ func processSetPermissionsCommand(conf *model.Configuration) {
702
685
conf .Permissions = model .PermissionFlags (p )
703
686
}
704
687
}
688
+ }
689
+
690
+ func processSetPermissionsCommand (conf * model.Configuration ) {
691
+ if perm != "" {
692
+ perm = permCompletion (perm )
693
+ }
694
+ if len (flag .Args ()) != 1 || selectedPages != "" {
695
+ fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePermSet )
696
+ os .Exit (1 )
697
+ }
698
+ if perm != "" && perm != "none" && perm != "print" && perm != "all" && ! isBinary (perm ) && ! isHex (perm ) {
699
+ fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePermSet )
700
+ os .Exit (1 )
701
+ }
702
+
703
+ inFile := flag .Arg (0 )
704
+ if conf .CheckFileNameExt {
705
+ ensurePDFExtension (inFile )
706
+ }
707
+
708
+ configPerm (perm , conf )
705
709
706
710
process (cli .SetPermissionsCommand (inFile , "" , conf ))
707
711
}
@@ -871,7 +875,7 @@ func addWatermarks(conf *model.Configuration, onTop bool) {
871
875
}
872
876
873
877
if len (flag .Args ()) < 3 || len (flag .Args ()) > 4 {
874
- fmt .Fprintf (os .Stderr , "%s\n \n " , u )
878
+ fmt .Fprintf (os .Stderr , "usage: %s\n \n " , u )
875
879
os .Exit (1 )
876
880
}
877
881
@@ -934,9 +938,9 @@ func processAddWatermarksCommand(conf *model.Configuration) {
934
938
}
935
939
936
940
func updateWatermarks (conf * model.Configuration , onTop bool ) {
937
- u := usageWatermarkAdd
941
+ u := usageWatermarkUpdate
938
942
if onTop {
939
- u = usageStampAdd
943
+ u = usageStampUpdate
940
944
}
941
945
942
946
if len (flag .Args ()) < 3 || len (flag .Args ()) > 4 {
@@ -1107,7 +1111,7 @@ func processImportImagesCommand(conf *model.Configuration) {
1107
1111
1108
1112
func processInsertPagesCommand (conf * model.Configuration ) {
1109
1113
if len (flag .Args ()) == 0 || len (flag .Args ()) > 2 {
1110
- fmt .Fprintf (os .Stderr , "%s\n \n " , usagePagesInsert )
1114
+ fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePagesInsert )
1111
1115
os .Exit (1 )
1112
1116
}
1113
1117
@@ -1138,7 +1142,7 @@ func processInsertPagesCommand(conf *model.Configuration) {
1138
1142
1139
1143
func processRemovePagesCommand (conf * model.Configuration ) {
1140
1144
if len (flag .Args ()) == 0 || len (flag .Args ()) > 2 || selectedPages == "" {
1141
- fmt .Fprintf (os .Stderr , "%s\n \n " , usagePagesRemove )
1145
+ fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usagePagesRemove )
1142
1146
os .Exit (1 )
1143
1147
}
1144
1148
@@ -1529,7 +1533,7 @@ func processRemoveKeywordsCommand(conf *model.Configuration) {
1529
1533
1530
1534
func processListPropertiesCommand (conf * model.Configuration ) {
1531
1535
if len (flag .Args ()) != 1 || selectedPages != "" {
1532
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageKeywordsList )
1536
+ fmt .Fprintf (os .Stderr , "usage: %s\n " , usagePropertiesList )
1533
1537
os .Exit (1 )
1534
1538
}
1535
1539
@@ -1903,7 +1907,7 @@ func processDumpCommand(conf *model.Configuration) {
1903
1907
1904
1908
func processCreateCommand (conf * model.Configuration ) {
1905
1909
if len (flag .Args ()) <= 1 || len (flag .Args ()) > 3 || selectedPages != "" {
1906
- fmt .Fprintf (os .Stderr , "usage: %s\n \n " , usageCreate )
1910
+ fmt .Fprintf (os .Stderr , "%s\n \n " , usageCreate )
1907
1911
os .Exit (1 )
1908
1912
}
1909
1913
@@ -2166,7 +2170,7 @@ func processMultiFillFormCommand(conf *model.Configuration) {
2166
2170
2167
2171
func processResizeCommand (conf * model.Configuration ) {
2168
2172
if len (flag .Args ()) < 2 || len (flag .Args ()) > 3 {
2169
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageResize )
2173
+ fmt .Fprintf (os .Stderr , "%s\n " , usageResize )
2170
2174
os .Exit (1 )
2171
2175
}
2172
2176
@@ -2200,7 +2204,7 @@ func processResizeCommand(conf *model.Configuration) {
2200
2204
2201
2205
func processPosterCommand (conf * model.Configuration ) {
2202
2206
if len (flag .Args ()) < 3 || len (flag .Args ()) > 4 {
2203
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usagePoster )
2207
+ fmt .Fprintf (os .Stderr , "%s\n " , usagePoster )
2204
2208
os .Exit (1 )
2205
2209
}
2206
2210
@@ -2236,7 +2240,7 @@ func processPosterCommand(conf *model.Configuration) {
2236
2240
2237
2241
func processNDownCommand (conf * model.Configuration ) {
2238
2242
if len (flag .Args ()) < 3 || len (flag .Args ()) > 5 {
2239
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageNDown )
2243
+ fmt .Fprintf (os .Stderr , "%s\n " , usageNDown )
2240
2244
os .Exit (1 )
2241
2245
}
2242
2246
@@ -2305,7 +2309,7 @@ func processNDownCommand(conf *model.Configuration) {
2305
2309
2306
2310
func processCutCommand (conf * model.Configuration ) {
2307
2311
if len (flag .Args ()) < 3 || len (flag .Args ()) > 4 {
2308
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageCut )
2312
+ fmt .Fprintf (os .Stderr , "%s\n " , usageCut )
2309
2313
os .Exit (1 )
2310
2314
}
2311
2315
@@ -2491,7 +2495,7 @@ func processSetPageModeCommand(conf *model.Configuration) {
2491
2495
v := flag .Arg (1 )
2492
2496
2493
2497
if ! validate .DocumentPageMode (v ) {
2494
- fmt .Fprintln (os .Stderr , "invalid page mode, use one of: UseNone, UseThumb , FullScreen, UseOC, UseAttachments" )
2498
+ fmt .Fprintln (os .Stderr , "invalid page mode, use one of: UseNone, UseOutlines, UseThumbs , FullScreen, UseOC, UseAttachments" )
2495
2499
os .Exit (1 )
2496
2500
}
2497
2501
@@ -2513,7 +2517,7 @@ func processResetPageModeCommand(conf *model.Configuration) {
2513
2517
2514
2518
func processListViewerPreferencesCommand (conf * model.Configuration ) {
2515
2519
if len (flag .Args ()) != 1 || selectedPages != "" {
2516
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferences )
2520
+ fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferencesList )
2517
2521
os .Exit (1 )
2518
2522
}
2519
2523
@@ -2526,7 +2530,7 @@ func processListViewerPreferencesCommand(conf *model.Configuration) {
2526
2530
2527
2531
func processSetViewerPreferencesCommand (conf * model.Configuration ) {
2528
2532
if len (flag .Args ()) != 2 || selectedPages != "" {
2529
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferences )
2533
+ fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferencesSet )
2530
2534
os .Exit (1 )
2531
2535
}
2532
2536
@@ -2549,7 +2553,7 @@ func processSetViewerPreferencesCommand(conf *model.Configuration) {
2549
2553
2550
2554
func processResetViewerPreferencesCommand (conf * model.Configuration ) {
2551
2555
if len (flag .Args ()) != 1 || selectedPages != "" {
2552
- fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferences )
2556
+ fmt .Fprintf (os .Stderr , "usage: %s\n " , usageViewerPreferencesReset )
2553
2557
os .Exit (1 )
2554
2558
}
2555
2559
0 commit comments