Adds -merge-no-struct-trees

This commit is contained in:
John Whitington 2024-01-22 15:53:41 +00:00
parent b43ca58b24
commit 415c172354
3 changed files with 13 additions and 1 deletions

View File

@ -32,6 +32,7 @@ o Report number of annotations in -page-info
o Specify image based only on file extension o Specify image based only on file extension
o -squeeze updates old compression methods o -squeeze updates old compression methods
o Show page size summary in -info o Show page size summary in -info
o Add -no-merge-struct-trees to prevent merging of structure trees
Fixes: Fixes:
@ -40,6 +41,7 @@ o Fixed -set-annotations with page links
o Allow Exif JPEGs as well as JFIF ones in -jpeg and -draw-jpeg o Allow Exif JPEGs as well as JFIF ones in -jpeg and -draw-jpeg
o Only compress a stream if it actually makes it smaller o Only compress a stream if it actually makes it smaller
2.6.1 (September 2023) 2.6.1 (September 2023)
o Fixed regression in UTF8 text with -add-text o Fixed regression in UTF8 text with -add-text

View File

@ -459,6 +459,7 @@ type args =
mutable boxes : bool; mutable boxes : bool;
mutable encrypt_metadata : bool; mutable encrypt_metadata : bool;
mutable retain_numbering : bool; mutable retain_numbering : bool;
mutable merge_struct_trees : bool;
mutable remove_duplicate_fonts : bool; mutable remove_duplicate_fonts : bool;
mutable remove_duplicate_streams : bool; mutable remove_duplicate_streams : bool;
mutable encoding : Cpdfmetadata.encoding; mutable encoding : Cpdfmetadata.encoding;
@ -593,6 +594,7 @@ let args =
boxes = false; boxes = false;
encrypt_metadata = true; encrypt_metadata = true;
retain_numbering = false; retain_numbering = false;
merge_struct_trees = true;
remove_duplicate_fonts = false; remove_duplicate_fonts = false;
remove_duplicate_streams = false; remove_duplicate_streams = false;
encoding = Cpdfmetadata.UTF8; encoding = Cpdfmetadata.UTF8;
@ -732,6 +734,7 @@ let reset_arguments () =
args.boxes <- false; args.boxes <- false;
args.encrypt_metadata <- true; args.encrypt_metadata <- true;
args.retain_numbering <- false; args.retain_numbering <- false;
args.merge_struct_trees <- true;
args.remove_duplicate_fonts <- false; args.remove_duplicate_fonts <- false;
args.remove_duplicate_streams <- false; args.remove_duplicate_streams <- false;
args.encoding <- Cpdfmetadata.UTF8; args.encoding <- Cpdfmetadata.UTF8;
@ -2013,6 +2016,9 @@ let setextractstreamdecomp i =
let setprintobj i = let setprintobj i =
args.op <- Some (PrintObj i) args.op <- Some (PrintObj i)
let setnomergestructtrees () =
args.merge_struct_trees <- false
(* Parse a control file, make an argv, and then make Arg parse it. *) (* Parse a control file, make an argv, and then make Arg parse it. *)
let rec make_control_argv_and_parse filename = let rec make_control_argv_and_parse filename =
control_args := !control_args @ parse_control_file filename control_args := !control_args @ parse_control_file filename
@ -2129,6 +2135,9 @@ and specs =
("-merge-add-bookmarks-use-titles", ("-merge-add-bookmarks-use-titles",
Arg.Unit setmergeaddbookmarksusetitles, Arg.Unit setmergeaddbookmarksusetitles,
" Use title of document rather than filename"); " Use title of document rather than filename");
("-no-merge-struct-trees",
Arg.Unit setnomergestructtrees,
" Do not merge structure trees");
("-remove-duplicate-fonts", ("-remove-duplicate-fonts",
Arg.Unit set_remove_duplicate_fonts, Arg.Unit set_remove_duplicate_fonts,
" Remove duplicate fonts when merging"); " Remove duplicate fonts when merging");
@ -3652,7 +3661,7 @@ let go () =
in in
let outpdf = let outpdf =
Pdfmerge.merge_pdfs Pdfmerge.merge_pdfs
args.retain_numbering args.remove_duplicate_fonts names pdfs rangenums args.retain_numbering args.remove_duplicate_fonts ~struct_hierarchy:args.merge_struct_trees names pdfs rangenums
in in
if args.remove_duplicate_streams then Pdfmerge.remove_duplicate_fonts outpdf; (* JBIG2 Globals *) if args.remove_duplicate_streams then Pdfmerge.remove_duplicate_fonts outpdf; (* JBIG2 Globals *)
write_pdf false outpdf write_pdf false outpdf

View File

@ -15,6 +15,7 @@
%Document -png -jpeg -jbig2 by extension %Document -png -jpeg -jbig2 by extension
%Document -extract-stream - check enc %Document -extract-stream - check enc
%Document -obj - check enc %Document -obj - check enc
%Document -merge-no-struct-trees in merge and collate
\documentclass{book} \documentclass{book}
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf, % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
% dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc. % dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.