Difference between revisions of "Viewer Layers"

From Wiki
Jump to navigation Jump to search
(NEW)
 
m
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
< [[Layers]] | [[Visuals]] | [[Presentations]] >
+
< [[Layers]] | [[Basics]] | [[Presentations]] >
  
 
PDF has a concept of layers that you can enable and disable (at least in a few viewers). This has nothing to do with ConTeXt’s [[Layers]].
 
PDF has a concept of layers that you can enable and disable (at least in a few viewers). This has nothing to do with ConTeXt’s [[Layers]].
  
There’s no other documentation yet, maybe have a look into the source {{src|attr-lay.mkiv}}.
+
There’s no other documentation yet, maybe have a look into the sources {{src|attr-lay.mkiv}}, {{src|attr-lay.lua}} and {{src|lpdf-ren.lua}}. It’s also used in some presentation styles.
  
 
<texcode>
 
<texcode>
Line 27: Line 27:
  
 
\input knuth
 
\input knuth
 +
 +
\viewerlayer[Plane]{Some more hidden text...}
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
You can switch the visibility of layers with the JavaScript functions HideLayer and VideLayer (from {{src|scrn-fld.mkvi}}:
 +
 +
<texcode>
 +
\defineviewerlayer[test]
 +
 +
\startviewerlayer[test]Hide Me\stopviewerlayer
 +
 +
\defineoverlay
 +
  [WithTest]
 +
  [{\overlayrollbutton[HideLayer{test}][VideLayer{test}]}]
 +
 +
\framed[background=WithTest]{toggle}
 +
</texcode>
 +
 +
 +
Viewer layers are known to work within {{cmd|setlayer}} (see [[Layers]]), e.g. {{src|meta-ini.mkiv}}.

Revision as of 12:19, 28 May 2020

< Layers | Basics | Presentations >

PDF has a concept of layers that you can enable and disable (at least in a few viewers). This has nothing to do with ConTeXt’s Layers.

There’s no other documentation yet, maybe have a look into the sources attr-lay.mkiv, attr-lay.lua and lpdf-ren.lua. It’s also used in some presentation styles.

\defineviewerlayer[Plane]
\setupviewerlayer[Plane][
  state=start,
  visible=no, % initially
  title=Test,
  %tag=, % don’t know?
  editable=yes, % in Acrobat Pro?
  printable=yes,
  export=yes, % exportable in xml?
  scope=global, % or local
]

\starttext
\input tufte

\startviewerlayer[Plane]
{\bfa TOP SECRET}
This information is on a different plane of existence.
\stopviewerlayer

\input knuth

\viewerlayer[Plane]{Some more hidden text...}
\stoptext

You can switch the visibility of layers with the JavaScript functions HideLayer and VideLayer (from scrn-fld.mkvi:

\defineviewerlayer[test]

\startviewerlayer[test]Hide Me\stopviewerlayer

\defineoverlay
   [WithTest]
   [{\overlayrollbutton[HideLayer{test}][VideLayer{test}]}]

\framed[background=WithTest]{toggle}


Viewer layers are known to work within \setlayer (see Layers), e.g. meta-ini.mkiv.