ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: hiding content
Date: Sun, 27 Jul 2008 14:26:22 +0200	[thread overview]
Message-ID: <488C696E.4040701@elvenkind.com> (raw)
In-Reply-To: <20080724194307.GA18010@gaston.couberia.bzh>

Peter Münster wrote:
> On Thu, Jul 24 2008, Wolfgang Schuster wrote:
> 
>>> Enabling people to view the pdf preview version (limited, containing
>>> excerpts) before acquiring the full version.
>> In this case the solution offered in the thread are no solution for your,
>> it's too easy for the customers to make the hidden content visible.
> 
> Shouldn't it be very easy with MKIV, to replace the content to hide with
> whatever you want?

Yes, pretty easy, but it depends a bit on what you want. Here is a
solution that really removes selected boxes from the output PDF
(it is un-optimised on purpose):

% engine = luatex

\defineattribute [ghosted]

\def\starthidden {\dosetattribute{ghosted}\plusone}
\def\stophidden  {\doresetattribute{ghosted}}

\ctxlua{
callback.register ('pre_output_filter', function (h)
   for v in node.traverse(h) do
      if (
          (
           v.id == node.id('hlist')
           or
           v.id == node.id('vlist')
          )
          and
          (
           node.has_attribute(v,\dogetattributeid{ghosted})
          )
         ) then
       node.free(v.list)
       v.list = nil
      end
   end
   return true
end)
}

> Examples:
> - the replacement are only the corresponding line-skips
> - the replacement are random letters printed in white

You can get those effects by changing the lua loop node.traverse
to do something more interesting (perhaps by recursive descend).

Best wishes,
Taci

___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  parent reply	other threads:[~2008-07-27 12:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 10:51 Alan Stone
2008-07-24 11:39 ` Wolfgang Schuster
2008-07-24 12:34 ` Alan Stone
2008-07-24 13:03   ` Wolfgang Schuster
2008-07-24 13:21     ` Alan Stone
2008-07-24 13:32       ` Wolfgang Schuster
2008-07-24 19:22         ` Mojca Miklavec
2008-07-24 19:43         ` Peter Münster
2008-07-25  6:29           ` Wolfgang Schuster
2008-07-25 11:53           ` Wolfgang Schuster
2008-07-25 14:40             ` Alan Stone
2008-07-27 12:26           ` Taco Hoekwater [this message]
2008-07-24 15:26       ` Charles P. Schaum
2008-07-24 17:47         ` Alan Stone
2008-07-24 18:02           ` Alan Stone
2008-07-25  7:46         ` Alan Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=488C696E.4040701@elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).