Faster attachments, fixes for manual bugs

This commit is contained in:
John Whitington 2014-11-18 10:51:14 +00:00
parent fd7dd879fd
commit 1f7c10e2b5
2 changed files with 13 additions and 32 deletions

15
cpdf.ml
View File

@ -642,17 +642,16 @@ let presentation range t d h i dir effect_dur pdf =
in in
Pdfpage.change_pages true pdf pages' Pdfpage.change_pages true pdf pages'
(* \section{Attaching files} *) (* Attaching files *)
let make_filestream file = let make_filestream file =
let data = let data =
let ch = open_in_bin file in let ch = open_in_bin file in
let len = in_channel_length ch in let len = in_channel_length ch in
let stream = mkbytes len in let stream = mkbytes len in
for x = 0 to bytes_size stream - 1 do let i = input_of_channel ch in
bset stream x (input_byte ch) setinit i stream 0 len;
done; close_in ch;
close_in ch; stream
stream
in in
Pdf.Stream Pdf.Stream
(ref (Pdf.Dictionary (ref (Pdf.Dictionary

View File

@ -1198,7 +1198,10 @@ let setcopyfontname s =
args.copyfontname <- Some s args.copyfontname <- Some s
let setpadevery i = let setpadevery i =
args.op <- Some (PadEvery i) if i > 0 then
args.op <- Some (PadEvery i)
else
error "PadEvery: must be > 0"
let setpadmultiple i = let setpadmultiple i =
args.op <- Some (PadMultiple i) args.op <- Some (PadMultiple i)
@ -1496,9 +1499,7 @@ and specs =
("-remove-duplicate-streams", ("-remove-duplicate-streams",
Arg.Unit setremoveduplicatestreams, Arg.Unit setremoveduplicatestreams,
""); "");
("-squeeze",
Arg.Unit setsqueeze,
"");
("-list-bookmarks", ("-list-bookmarks",
Arg.Unit (setop ListBookmarks), Arg.Unit (setop ListBookmarks),
" List Bookmarks"); " List Bookmarks");
@ -1826,29 +1827,9 @@ and specs =
("-label-startval", ("-label-startval",
Arg.Int setlabelstartval, Arg.Int setlabelstartval,
" Set label start value (default 1)"); " Set label start value (default 1)");
(* These items are for cpdftk *)
(*("-update-info", Arg.String setupdateinfo, "");
("-printf-format", Arg.Unit setprintfformat, "");
("-dump-data", Arg.Unit (setop DumpData), "");
("-keep-this-id", Arg.Unit setkeepthisid, "");
("-do-ask", Arg.Unit setdoask, "");
("-verbose", Arg.Unit setverbose, "");
("-prompt-inputs", Arg.Unit promptinputs, "");
("-prompt-input-passwords", Arg.Unit promptinputpasswords, "");
("-prompt-output", Arg.Unit promptoutput, "");
("-dont-overwrite-existing-files", Arg.Unit setdontoverwriteexistingfiles, "");
("-dont-overwrite-inputs", Arg.Unit setdontoverwriteinputs, "");
("-make-new-id", Arg.Unit setmakenewid, "");
("-upright-stamp", Arg.Unit setuprightstamp, "");
("-remove-unused-resources", Arg.Unit (setop RemoveUnusedResources), "");
("-stamp-under-multi", Arg.String setstampundermulti, "");
("-stamp-on-multi", Arg.String setstamponmulti, "");
("-list-annotations-more", Arg.Unit (setop ListAnnotationsMore), "");*)
(*These items are undocumented *) (*These items are undocumented *)
("-extract-fontfile", Arg.Unit (setop ExtractFontFile), ""); ("-extract-fontfile", Arg.Unit (setop ExtractFontFile), "");
("-extract-images", Arg.Unit setextractimages, ""); ("-extract-images", Arg.Unit setextractimages, "");
(*("-output-graph", Arg.Unit (setoutputgraph), "");*)
("-csp1", Arg.Unit (setop CSP1), ""); ("-csp1", Arg.Unit (setop CSP1), "");
("-csp2", Arg.Float setcsp2, ""); ("-csp2", Arg.Float setcsp2, "");
("-csp3", Arg.Unit (setop CSP3), ""); ("-csp3", Arg.Unit (setop CSP3), "");
@ -1859,6 +1840,7 @@ and specs =
("-debug", Arg.Unit setdebug, ""); ("-debug", Arg.Unit setdebug, "");
("-debug-crypt", Arg.Unit setdebugcrypt, ""); ("-debug-crypt", Arg.Unit setdebugcrypt, "");
("-fix-prince", Arg.Unit (setop RemoveUnusedResources), ""); ("-fix-prince", Arg.Unit (setop RemoveUnusedResources), "");
("-squeeze", Arg.Unit setsqueeze, "");
("-extract-text", Arg.Unit (setop ExtractText), "")] ("-extract-text", Arg.Unit (setop ExtractText), "")]
and usage_msg = and usage_msg =