From 0efd0b0a505f4a11adb6b6d45ea52e9a5a343abe Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 21 Oct 2024 14:11:51 +0100 Subject: [PATCH] Move autotagging text from sections to text/para --- cpdfdraw.ml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cpdfdraw.ml b/cpdfdraw.ml index db83e02..e6038bf 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -460,7 +460,18 @@ let rec ops_of_drawop struct_tree dryrun pdf endpage filename bates batespad num flatten (map (function para -> - (if not !first && indent = None then ([Pdfops.Op_T']) else (clear first; [])) @ format_paragraph (if indent <> None && not !first then unopt indent else 0.) j w para) + let begintag = + let m = mcid () in + if not dryrun && !do_auto_tag then structdata := StDataMCID ("/P", m)::!structdata; + if struct_tree && !do_auto_tag then [Pdfops.Op_BDC ("/P", Pdf.Dictionary ["/MCID", Pdf.Integer m])] else [] + in + let endtag = + if struct_tree && !do_auto_tag then [Pdfops.Op_EMC] else [] + in + begintag + @ (if not !first && indent = None then [Pdfops.Op_T'] else (clear first; [])) + @ format_paragraph (if indent <> None && not !first then unopt indent else 0.) j w para + @ endtag) s) | Leading f -> [Pdfops.Op_TL f] | CharSpace f -> [Pdfops.Op_Tc f]