pdfroff is a very clever and useful utility in groff and I'd appreciate advice on how best to integrate it into gropdf. Currently gropdf includes its own pdfmark macros which are intended as a drop in replacement for pdfmark.tmac, in fact most of the macros are based on Keith Marshall's work.
Pdroff does the following:- A) Resolves all forward references by having multiple groff runs. B) Allows an optional cover sheet to be included as a frontispiece (-- stylesheet). C) Relocates the TOC to the 2nd page. The first two functions are already implemented by doing:- groff -M. -mspdf2 -ms -T pdf -dPDF.EXPORT=1 -z cover.ms pdfmark.ms 2>&1 | groff -M. -mspdf2 -ms -Tpdf - cover.ms pdfmark.ms | okular - Where spdf2 is a slightly tweaked version of Keith's spdf.tmac (which works with both the grops and gropdf back ends). The main difference is that the Table of Contents is not automatically relocated, and it is on this I would like advice. In a pdf every page is an object and the page order is given in an array called "kids" which is an attribute of the "pages" object. So to reorder the pages in a pdf is simply a case of reordering this array before it is written to the file. Currently I just push each new page onto the end of the kids array, but it might be better to introduce a pair of "\X pdf:" commands which alter the insertion point for all following pages. Something along the lines of:- \X pdf: pagename <name> \" name a location in the file \X pdf: switchtopage (before|after) <name> \" start inserting pages before/after the named page. If this was implemented any macros which include a TOC generator could be amended to position the TOC anywhere in the document, and if not using gropdf it would appear as now. Does this sound like a reasonable facility? Cheers Deri