Fix combine_pages to work well with renumber_pages
This commit is contained in:
parent
a673e96090
commit
472a4ce286
38
cpdf.ml
38
cpdf.ml
|
@ -2320,33 +2320,17 @@ let combine_pages (fast : bool) under over scaletofit swap equalize =
|
||||||
merged o u over)
|
merged o u over)
|
||||||
over_pages under_pages
|
over_pages under_pages
|
||||||
in
|
in
|
||||||
let changed = Pdfpage.change_pages true merged new_pages in
|
(* we use new_pages @ new_pages here to preserve the number of pages
|
||||||
Pdfmarks.add_bookmarks (marks_under @ marks_over) changed
|
* so that Pdfpage.change_pages can do its renumbering properly.
|
||||||
|
* Otherwise things like outlines are lost. TODO: Fix
|
||||||
(*Printf.printf "combine_pages: fast = %b\n" fast;
|
* Pdfpage.change_pages properly. For now, we just use
|
||||||
flush stdout;
|
* Pdfpage.pdf_of_pages afterward to chop it. *)
|
||||||
Printf.printf "Under size\n";
|
let changed = Pdfpage.change_pages true merged (new_pages @ new_pages) in
|
||||||
report_pdf_size under;
|
let cut =
|
||||||
Printf.printf "Over size\n";
|
Pdfpage.pdf_of_pages ~retain_numbering:true changed (ilist 1 (length new_pages))
|
||||||
report_pdf_size over;*)
|
in
|
||||||
|
(* Now shorten to just new_pages *)
|
||||||
(*Printf.printf "prefix was %s\n" prefix;*)
|
Pdfmarks.add_bookmarks (marks_under @ marks_over) cut
|
||||||
|
|
||||||
(*Printf.printf "added prefix\n";
|
|
||||||
Printf.printf "under now:\n";
|
|
||||||
report_pdf_size under;
|
|
||||||
Printf.printf "over now:\n";
|
|
||||||
report_pdf_size over;*)
|
|
||||||
(*Printf.printf "merged\n";
|
|
||||||
flush stdout;
|
|
||||||
report_pdf_size merged;*)
|
|
||||||
(*Printf.printf "stamped\n";
|
|
||||||
flush stdout;*)
|
|
||||||
(*Printf.printf "pages changed\n";
|
|
||||||
flush stdout;*)
|
|
||||||
(*report_pdf_size r;
|
|
||||||
Printf.printf "bookmarks added\n";
|
|
||||||
flush stdout;*)
|
|
||||||
|
|
||||||
let nobble_page pdf _ page =
|
let nobble_page pdf _ page =
|
||||||
let minx, miny, maxx, maxy =
|
let minx, miny, maxx, maxy =
|
||||||
|
|
|
@ -3072,8 +3072,6 @@ let addrectangle (w, h) color position relative_to_cropbox underneath range pdf
|
||||||
in
|
in
|
||||||
Cpdf.process_pages addrectangle_page pdf range
|
Cpdf.process_pages addrectangle_page pdf range
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(* Main function *)
|
(* Main function *)
|
||||||
let go () =
|
let go () =
|
||||||
match args.op with
|
match args.op with
|
||||||
|
|
Loading…
Reference in New Issue