[NTG-context] Support for Optional Content Groups

Wolfgang Schuster schuster.wolfgang at gmail.com
Thu Jul 3 18:33:42 CEST 2014


Am 03.07.2014 um 17:55 schrieb Chris Chapman <chris at pentandra.com>:

> I am new to ConTeXt (coming from LaTeX), and am really impressed. Great work!
> 
> I am working on a document that has layers that I want to be screen-only, similar in approach to this: 
> http://tex.stackexchange.com/questions/167846/implementing-full-page-screen-only-print-only-in-pdf
> 
> I am assuming that Optional Content Groups would be the best way to do this. How would I set something up like this in ConTeXt/LuaTeX? I know I could make a screen-only version and a print version of the output pdf, but I want to have my cake and eat it too ;)


You can test if the layers are hidden when you print the following example, I tried the Adobe Reader on my Mac and they where still visible.

\setupinteraction[state=start]

\defineoverlay[PageBackground] [\startMPcode fill fullsquare xyscaled(OverlayWidth,OverlayHeight) withcolor \MPcolor{orange} ; \stopMPcode]
\defineoverlay[FrameBackground][\startMPcode fill fullsquare xyscaled(OverlayWidth,OverlayHeight) withcolor \MPcolor{green} ;  \stopMPcode]

%\setupbackgrounds[page][background=color,backgroundcolor=orange] % doesn’t work because you can only hide the background together with the text
\setupbackgrounds[page][background=PageBackground]

\setupviewerlayer[printable=no]

\defineviewerlayer[mylayer]

%\showlayoutcomponents % use this to enable/disable certain text areas

\starttext

\input knuth

\startviewerlayer[mylayer]
\input ward
\stopviewerlayer

\input tufte

\startframedtext[width=max,background=FrameBackground]
\input weisman
\stopframedtext

\stoptext

Wolfgang


More information about the ntg-context mailing list