Allow page specifications for -open-at-page-{fit}
This commit is contained in:
parent
0a77fcfe3e
commit
a239cf4edb
|
@ -170,8 +170,8 @@ type op =
|
||||||
| RemoveUnusedResources
|
| RemoveUnusedResources
|
||||||
| ExtractFontFile
|
| ExtractFontFile
|
||||||
| ExtractText
|
| ExtractText
|
||||||
| OpenAtPage of int
|
| OpenAtPage of string
|
||||||
| OpenAtPageFit of int
|
| OpenAtPageFit of string
|
||||||
| AddPageLabels
|
| AddPageLabels
|
||||||
| RemovePageLabels
|
| RemovePageLabels
|
||||||
| PrintPageLabels
|
| PrintPageLabels
|
||||||
|
@ -1953,10 +1953,10 @@ and specs =
|
||||||
Arg.String setpagemode,
|
Arg.String setpagemode,
|
||||||
" Set page mode upon document opening");
|
" Set page mode upon document opening");
|
||||||
("-open-at-page",
|
("-open-at-page",
|
||||||
Arg.Int setopenatpage,
|
Arg.String setopenatpage,
|
||||||
" Set initial page");
|
" Set initial page");
|
||||||
("-open-at-page-fit",
|
("-open-at-page-fit",
|
||||||
Arg.Int setopenatpagefit,
|
Arg.String setopenatpagefit,
|
||||||
" Set inital page, scaling to fit");
|
" Set inital page, scaling to fit");
|
||||||
("-set-metadata",
|
("-set-metadata",
|
||||||
Arg.String setmetadata,
|
Arg.String setmetadata,
|
||||||
|
@ -4007,10 +4007,16 @@ let go () =
|
||||||
let version = if args.keepversion then pdf.Pdf.minor else version in
|
let version = if args.keepversion then pdf.Pdf.minor else version in
|
||||||
write_pdf false (Cpdf.set_viewer_preference (key, value, version) pdf)
|
write_pdf false (Cpdf.set_viewer_preference (key, value, version) pdf)
|
||||||
end
|
end
|
||||||
| Some (OpenAtPage n) ->
|
| Some (OpenAtPage str) ->
|
||||||
write_pdf false (Cpdf.set_open_action (get_single_pdf args.op false) false n)
|
let pdf = get_single_pdf args.op false in
|
||||||
| Some (OpenAtPageFit n) ->
|
let range = parse_pagespec pdf str in
|
||||||
write_pdf false (Cpdf.set_open_action (get_single_pdf args.op false) true n)
|
let n = match range with [x] -> x | _ -> error "open_at_page: range does not specify single page" in
|
||||||
|
write_pdf false (Cpdf.set_open_action pdf false n)
|
||||||
|
| Some (OpenAtPageFit str) ->
|
||||||
|
let pdf = get_single_pdf args.op false in
|
||||||
|
let range = parse_pagespec pdf str in
|
||||||
|
let n = match range with [x] -> x | _ -> error "open_at_page: range does not specify single page" in
|
||||||
|
write_pdf false (Cpdf.set_open_action pdf true n)
|
||||||
| Some (SetMetadata metadata_file) ->
|
| Some (SetMetadata metadata_file) ->
|
||||||
write_pdf false (Cpdf.set_metadata args.keepversion metadata_file (get_single_pdf args.op false))
|
write_pdf false (Cpdf.set_metadata args.keepversion metadata_file (get_single_pdf args.op false))
|
||||||
| Some (SetVersion v) ->
|
| Some (SetVersion v) ->
|
||||||
|
|
Loading…
Reference in New Issue