Can't hide element in body when printing...

We have a form for a Monthly Customer Statement, showing all the stuff bought. This is printed on headed, perforated paper. Some customers prefer receiving their statements via email, so we use Servoy to send out emails with PDFs (the perforation shown as a dotted line).

We use one form for both versions of the statement. We have named all the elements we want to hide on the paper version. There is a simple script which runs through the list of elements and shows or hides them, something like this:

var vis = arguments[0];
elements.line1.visible = vis;
elements.line2.visible = vis;

If we try to hide an element in the body part of the form, we get a null-pointer exception in Servoy Developer 3.1.3, unless we have displayed the form manually on screen before trying to print.

We can access the offending element via the debugger… but not in a script…

While I do think this is a bit odd (in fact, I can’t reproduce it), Servoy supplies a better way to do just this. The form editor shows a property called ‘printable’ that can be used to prevent elements from being printed. This is a design-time property - it isn’t scriptable.

Hi, a design-time property will not work in this case. I’m really trying to avoid having two forms.