Fixed nobble bug

This commit is contained in:
John Whitington 2014-10-22 11:48:20 +01:00
parent 639af8527e
commit 268979835f
1 changed files with 17 additions and 18 deletions

View File

@ -1,5 +1,5 @@
(* cpdf command line tools *) (* cpdf command line tools *)
let demo = false let demo = true
let noncomp = false let noncomp = false
let major_version = 1 let major_version = 1
let minor_version = 8 let minor_version = 8
@ -557,7 +557,6 @@ let rec decrypt_if_necessary (_, _, _, user_pw, owner_pw) op pdf =
soft_error "Failed to decrypt file: wrong password?" soft_error "Failed to decrypt file: wrong password?"
let nobble pdf = let nobble pdf =
flprint "nobble\n";
if not demo then pdf else if not demo then pdf else
Cpdf.process_pages (Cpdf.nobble_page pdf) pdf (ilist 1 (Pdfpage.endpage pdf)) Cpdf.process_pages (Cpdf.nobble_page pdf) pdf (ilist 1 (Pdfpage.endpage pdf))
@ -1929,14 +1928,14 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
| File outname -> | File outname ->
begin match encryption with begin match encryption with
None -> None ->
ignore (nobble pdf); let pdf = nobble pdf in
if not is_decompress then if not is_decompress then
begin begin
ignore (Cpdf.recompress_pdf pdf); ignore (Cpdf.recompress_pdf pdf);
if args.squeeze then Cpdf.squeeze pdf; if args.squeeze then Cpdf.squeeze pdf;
Pdf.remove_unreferenced pdf Pdf.remove_unreferenced pdf
end; end;
really_write_pdf mk_id pdf outname really_write_pdf mk_id pdf outname
| Some _ -> | Some _ ->
really_write_pdf ~encryption mk_id pdf outname really_write_pdf ~encryption mk_id pdf outname
end end
@ -1944,14 +1943,14 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
let temp = Filename.temp_file "cpdflin" ".pdf" in let temp = Filename.temp_file "cpdflin" ".pdf" in
begin match encryption with begin match encryption with
None -> None ->
ignore (nobble pdf); let pdf = nobble pdf in
if not is_decompress then if not is_decompress then
begin begin
ignore (Cpdf.recompress_pdf pdf); ignore (Cpdf.recompress_pdf pdf);
if args.squeeze then Cpdf.squeeze pdf; if args.squeeze then Cpdf.squeeze pdf;
Pdf.remove_unreferenced pdf Pdf.remove_unreferenced pdf
end; end;
really_write_pdf ~encryption mk_id pdf temp; really_write_pdf ~encryption mk_id pdf temp;
| Some _ -> | Some _ ->
really_write_pdf ~encryption mk_id pdf temp really_write_pdf ~encryption mk_id pdf temp
end; end;