From 3cf1f914c1f0cc2ef39f98c18c1a6d5cc8bccc52 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Fri, 4 Oct 2024 14:42:31 +0100 Subject: [PATCH] Avoid tagging if no process_struct_tree --- cpdftexttopdf.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpdftexttopdf.ml b/cpdftexttopdf.ml index b7e1c7c..3459e0a 100644 --- a/cpdftexttopdf.ml +++ b/cpdftexttopdf.ml @@ -86,7 +86,7 @@ let typeset ~process_struct_tree ?subformat ?title ~papersize ~font ~fontsize te let instrs = of_utf8_with_newlines fontpack fontsize (Pdfio.string_of_bytes text) in (*flprint (Cpdftype.to_string instrs); flprint "------------------------------";*) - let tagged = tag_paragraphs instrs in + let tagged = if process_struct_tree then tag_paragraphs instrs else instrs in (*flprint (Cpdftype.to_string tagged);*) let margin = Pdfunits.points (Pdfpaper.width papersize) (Pdfpaper.unit papersize) /. 15. in let instrs = @@ -122,12 +122,12 @@ let typeset ~process_struct_tree ?subformat ?title ~papersize ~font ~fontsize te | [] -> rev (map rev a) in let nodes = find_nodes [[]] tagtriples in - Printf.printf "Paragraphs and their page and MCIDs\n"; + (*Printf.printf "Paragraphs and their page and MCIDs\n"; iter (fun parts_of_para -> Printf.printf "Paragraph:\n"; iter (fun (para, page, mcid) -> Printf.printf "Para %i, Page %i, MCID %i\n" para page mcid) parts_of_para) - nodes; + nodes;*) let pages = map2 (fun pn p -> if process_struct_tree then {p with Pdfpage.rest = Pdf.add_dict_entry p.Pdfpage.rest "/StructParents" (Pdf.Integer pn)} else p)