more
This commit is contained in:
parent
3cb5e13a90
commit
a4c06ee03a
|
@ -171,6 +171,7 @@ type op =
|
|||
| ListBookmarks
|
||||
| SetPageLayout of string
|
||||
| SetPageMode of string
|
||||
| SetNonFullScreenPageMode of string
|
||||
| HideToolbar of bool
|
||||
| HideMenubar of bool
|
||||
| HideWindowUI of bool
|
||||
|
@ -297,6 +298,7 @@ let string_of_op = function
|
|||
| ListBookmarks -> "ListBookmarks"
|
||||
| SetPageLayout _ -> "SetPageLayout"
|
||||
| SetPageMode _ -> "SetPageMode"
|
||||
| SetNonFullScreenPageMode _ -> "SetNonFullScreenPageMode"
|
||||
| HideToolbar _ -> "HideToolbar"
|
||||
| HideMenubar _ -> "HideMenubar"
|
||||
| HideWindowUI _ -> "HideWindowUI"
|
||||
|
@ -818,7 +820,7 @@ let banned banlist = function
|
|||
| PrintPageLabels | Clean | Compress | Decompress
|
||||
| ChangeId | CopyId _ | ListSpotColours | Version
|
||||
| DumpAttachedFiles | RemoveMetadata | EmbedMissingFonts | BookmarksOpenToLevel _ | CreatePDF
|
||||
| SetPageMode _ | HideToolbar _ | HideMenubar _ | HideWindowUI _
|
||||
| SetPageMode _ | SetNonFullScreenPageMode _ | HideToolbar _ | HideMenubar _ | HideWindowUI _
|
||||
| FitWindow _ | CenterWindow _ | DisplayDocTitle _
|
||||
| RemoveId | OpenAtPageFit _ | OpenAtPage _ | SetPageLayout _
|
||||
| ShowBoxes | TrimMarks | CreateMetadata | SetMetadataDate _ | SetVersion _
|
||||
|
@ -1039,6 +1041,7 @@ let setmetadata s = setop (SetMetadata s) ()
|
|||
let setversion i = setop (SetVersion i) ()
|
||||
let setpagelayout s = setop (SetPageLayout s) ()
|
||||
let setpagemode s = setop (SetPageMode s) ()
|
||||
let setnonfullscreenpagemode s = setop (SetNonFullScreenPageMode s) ()
|
||||
|
||||
let hidetoolbar b =
|
||||
try setop (HideToolbar (bool_of_string b)) () with
|
||||
|
@ -2552,6 +2555,9 @@ and specs =
|
|||
("-set-page-mode",
|
||||
Arg.String setpagemode,
|
||||
" Set page mode upon document opening");
|
||||
("-set-non-full-page-mode",
|
||||
Arg.String setnonfullscreenpagemode,
|
||||
" Set non full screen page mode if page mode is FullScreen");
|
||||
("-open-at-page",
|
||||
Arg.String setopenatpage,
|
||||
" Set initial page");
|
||||
|
@ -3832,6 +3838,8 @@ let go () =
|
|||
write_pdf false (Cpdfmetadata.set_page_layout (get_single_pdf args.op false) s)
|
||||
| Some (SetPageMode s) ->
|
||||
write_pdf false (Cpdfmetadata.set_page_mode (get_single_pdf args.op false) s)
|
||||
| Some (SetNonFullScreenPageMode s) ->
|
||||
write_pdf false (Cpdfmetadata.set_non_full_screen_page_mode (get_single_pdf args.op false) s)
|
||||
| Some Split ->
|
||||
begin match args.inputs, args.out with
|
||||
| [(f, ranges, _, _, _, _)], File output_spec ->
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
%Document extensions to -info
|
||||
%Document Topleft2 etc.
|
||||
%Test new camlpdf unit conversions
|
||||
%Document -non-full-screen-page-mode
|
||||
\documentclass{book}
|
||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||
% dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.
|
||||
|
|
|
@ -655,6 +655,32 @@ let set_page_mode pdf s =
|
|||
end
|
||||
| _ -> error "Unknown page mode"
|
||||
|
||||
let set_non_full_screen_page_mode pdf s =
|
||||
match s with
|
||||
| "UseNone" | "UseOutlines" | "UseThumbs"
|
||||
| "UseOC" | "UseAttachments" ->
|
||||
begin match Pdf.lookup_direct pdf "/Root" pdf.Pdf.trailerdict with
|
||||
| Some catalog ->
|
||||
let viewerprefs =
|
||||
match Pdf.lookup_direct pdf "/ViewerPreferences" catalog with
|
||||
| Some d -> d
|
||||
| None -> Pdf.Dictionary []
|
||||
in
|
||||
let viewerprefsnum =
|
||||
Pdf.addobj pdf (Pdf.add_dict_entry viewerprefs "/NonFullScreenPageMode" (Pdf.Name ("/" ^ s)))
|
||||
in
|
||||
let catalog' = Pdf.add_dict_entry catalog "/ViewerPreferences" (Pdf.Indirect viewerprefsnum)in
|
||||
let catalognum = Pdf.addobj pdf catalog' in
|
||||
let trailerdict' =
|
||||
Pdf.add_dict_entry pdf.Pdf.trailerdict "/Root" (Pdf.Indirect catalognum)
|
||||
in
|
||||
{pdf with
|
||||
Pdf.root = catalognum;
|
||||
Pdf.trailerdict = trailerdict'}
|
||||
| None -> error "bad root"
|
||||
end
|
||||
| _ -> error "Unknown non full screen page mode"
|
||||
|
||||
(* Set open action *)
|
||||
let set_open_action pdf fit pagenumber =
|
||||
if pagenumber > Pdfpage.endpage pdf || pagenumber < 0 then
|
||||
|
|
|
@ -32,9 +32,12 @@ val set_viewer_preference : (string * Pdf.pdfobject * int) -> Pdf.t -> Pdf.t
|
|||
(** Set the page layout to the given name (sans slash) e.g SinglePage *)
|
||||
val set_page_layout : Pdf.t -> string -> Pdf.t
|
||||
|
||||
(** Set the page layout to the given name (sans slash) e.g SinglePage *)
|
||||
(** Set the page mode to the given name (sans slash) e.g UseThumbs *)
|
||||
val set_page_mode : Pdf.t -> string -> Pdf.t
|
||||
|
||||
(** Set the non full screen page mode to the given name (sans slash) e.g UseThumbs *)
|
||||
val set_non_full_screen_page_mode : Pdf.t -> string -> Pdf.t
|
||||
|
||||
(** Set the open action. If the boolean is true, /Fit will be used, otherwise /XYZ *)
|
||||
val set_open_action : Pdf.t -> bool -> int -> Pdf.t
|
||||
|
||||
|
|
Loading…
Reference in New Issue