Dear list,

I have an over a thousand pages document generated with ConTeXt.

I need to print and chapters and part of chapters (or send to other people).

/PrintPageRange is great (and you can even generate a new document
containing only the pages in /PrintPageRange). But the issue here is
that I would need to recompile the document again for each new required
/PrintPageRange.

Another approach would be to add PDF annotations (outside page
boundaries) to store the desired information.

So I created text annotations (using \comment) with author information
composed from unit number (such as "i3", "ii9" or "iii28"), info on the
unit part (such as "-explanation", "-synopsis", "-exercises", or others)
and position ("-start" and "-stop").

This would make author fields such as "i3-start" (which has a
corresponding "i3-stop", or "ii22-synopsis-start" (with the
corresponding closing annotation).

To make easier to identify these annotations, they all share the same
title. As contents, all these text annotations have the page number.

From the generated PDF document, I need to read all text annotations in
order to extract two fields from those annotations that contain a
"whatever" /Subj. These fields are /T and /Contents.

I guess that the way to deal with the (over 700) annotations would be to
store both fields in a Lua table. But this is only a suspicion, since I
don’t know how to read the values, how to store them, or how to compare
them with specific units or unit parts to get these page numbers.

I mean, with a command such as
\extractpages{i5,i8-exercises,i15-explanation} would get the pages for
each "-start" and "-stop" that could be passed automatically to a
\filterpages command.

A sample that generates something similar:

  \setuppapersize[A8]
  \setupinteraction[state=start]
  \starttext
  \dorecurse{5}{\part{\romannumerals{\recurselevel}}
  \dorecurse{15}{\chapter{\recurselevel}
  \comment
      [title=whatever,
       color=yellow,
  %~ the following code is to have expansion in interaction
       author={\ctxlua{context([[\namedstructurevariable{part}{title}%
        \namedstructurevariable{chapter}{title}]].."-start")}}]
      {\pagenumber}
  \doloopoverlist{explanation,exercises,synopsis}{\chapter{\recurselevel}
  %~ I would like to use \recursestring, but it is undefined here
  \comment
      [title=whatever,
       color=green,
       author={\ctxlua{context([[\namedstructurevariable{part}{title}%
        \namedstructurevariable{chapter}{title}]]..
          [[-\recurselevel]].."-start")}}]
      {\pagenumber}
  \dorecurse{5}{\null\page}
  \comment
      [title=whatever,
       color=blue,
       author={\ctxlua{context([[\namedstructurevariable{part}{title}%
        \namedstructurevariable{chapter}{title}]]..
          [[-\recurselevel]].."-stop")}}]
      {\pagenumber}
  }
  \comment
      [title=whatever,
       color=red,
       author={\ctxlua{context([[\namedstructurevariable{part}{title}%
        \namedstructurevariable{chapter}{title}]].."-stop")}}]
      {\pagenumber}
  }
  }
  \stoptext

Is there a way to deal with the annotations in the document generated
from the code above, in the way I described before?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to