Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Fields with Visible(screen only) space excluded from printing

Avatar

Level 2

Afternoon

Could someone please tell me (in novice terms) how to make a field that is Visible(screen only)  also hide the space that the field uses when printing please.

As it stands the dropdown I am using is visible on the screen but it shows a blank space on the print-out which I need to get rid of.

I can provide a sample if need be.

Many thanks in advance

Ben

5 Replies

Avatar

Level 10

You'll have to create a floating layout and then use the prePrint and postPrint events of those objects to execute a script to hide or show them.

To hide an object with the prePrint event add this script.

this.presence = "hidden";

To show it after printing add this to the postPrint event.

this.presence = "visible";

Avatar

Level 2

Thanks Radzmar

I'm struggling with where this goes in the scripting.  Is there any chance you could show me if I paste in the script or send a sample please?

It would be greatly appreciated.

Avatar

Level 10

Ok,

each object (subform, field, page, table etc.) has multiple events available for scripting, right?!

For example.

You have a subform, that you don't want to occur when printing.

Select these subform, open the script editor and select the prePrint event drom the drop down box.

Set the language to javaScript and then enter the script:

this.presence = "hidden";

The script always executes when a print commant occurs and the subform and all objects it's containing become hidden.

You will see this in the print dialogs document preview.

To make the subform visible after printing, also select the postPrint event and add this script.

this.presence = "visible";

Avatar

Level 2

Got it! I was looking in the XML source so couldn't see what you were getting.  It's not showing up on the print now which is good but it looks like all the actions that I had set for the dropdown within the subform have broke.  Presumably I can just set them again and we're good to go?

Thanks for your patience

Avatar

Level 2

Sorry another question.

I have a table and at the top of it I have 'Add row' and 'Remove row' buttons which are contained within the subform.  The buttons are visible on screen but not on the print the same as before but I don't want the gap to show on the print.  When I apply to Pre and Post Print commands the buttons it doesn't work.  I've tried to wrap them in a separate subform but then the add and remove functions won't work.

Any ideas how I can get just the buttons to disappear when printing without affecting the functions?

Many thanks