Note typeset improvements

This commit is contained in:
John Whitington 2025-03-08 14:04:57 +00:00
parent 21aa7d7404
commit b4514e3418
2 changed files with 9 additions and 4 deletions

View File

@ -158,9 +158,12 @@ let ensure_minimal_struct_tree pdf =
Pdf.addobj_given_num pdf (pdf.Pdf.root, (Pdf.add_dict_entry (Pdf.lookup_obj pdf pdf.Pdf.root) "/StructTreeRoot" str))
(* Typeset a table of contents with given font, font size and title. Mediabox
(and CropBox) copied from first page of existing PDF. Margin of 10% inside
CropBox. Font size of title twice body font size. Null page labels added for
TOC, others bumped up and so preserved. *)
copied from first page of existing PDF cropbox, or mediabox if no crop box.
Margin of 10%. Font size of title twice body font size. Null page labels
added for TOC, others bumped up and so preserved. *)
(* TODO Fix Cpdftype to take a box not a papersize/margins combo. Then we can remove all the CropBox/Mediabox complications here.
Then copying the boxes directly from the first page of the document is ok, and we just prefer the cropbox. Failing file
__PDFUA/decomp/08.pdf *)
let typeset_table_of_contents ~font ~fontsize ~title ~bookmark ~dotleader ~process_struct_tree pdf =
let optional l = if process_struct_tree then l else [] in
if process_struct_tree then ensure_minimal_struct_tree pdf;

View File

@ -5,11 +5,13 @@
For now, this is just an experiment for -table-of-contents and -typeset. To
be continued... *)
(* At the moment, structure tree support is limited. Cpdftoc.ml and
(* TODO At the moment, structure tree support is limited. Cpdftoc.ml and
Cpdftexttopdf do it by post-processing. We need to fix this, which might
involve returning more than just a list of pages, but in fact working on the
document. *)
(* TODO Should be able to take any box to typeset in. This papersize/margins
combination is very limiting, for example in Cpdftoc. *)
open Pdfutil
(* Main type *)