Expand my Community achievements bar.

SOLVED

Hide borders while printing

Avatar

Level 2

I am creating a form and I would like the borders of some of the text fields to be hidden when the document is printed without hiding the contents completely I would appreciate any suggestions on how this could be done.

Thanks,

John

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi John,

Yes, it is TextField4 on page2:

Acrobat1.png

The script in the object's prePrint event is:

var vName = this.name.toString();


xfa.resolveNode(vName + ".ui.textEdit.border.edge").presence = "invisible";

The script in the postPrint changes it back to visible.

Is that working for you?

Niall

Assure Dynamics

View solution in original post

5 Replies

Avatar

Level 10

Hi John,

I have a sample here:

http://www.assuredynamics.com/index.php/category/portfolio/laying-out-form-objects/

If you have a look at the objects in the middle column on page2, you will see script in the prePrint and postPrint events to hide the border (change presence property).

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 2

Niall,

When I tried out your form the border in the Name field (TextField4) still showed up when I printed it. Is there something else I need to do in order for the javascript to work correctly?

Thanks,

John

Avatar

Correct answer by
Level 10

Hi John,

Yes, it is TextField4 on page2:

Acrobat1.png

The script in the object's prePrint event is:

var vName = this.name.toString();


xfa.resolveNode(vName + ".ui.textEdit.border.edge").presence = "invisible";

The script in the postPrint changes it back to visible.

Is that working for you?

Niall

Assure Dynamics

Avatar

Level 2

I see in your photo where the border does not show up when you print it, but it continues to show up when I print. Is there a setting I'm missing or something?

John

Avatar

Level 10

Hi John,

Are you opening the form in Acrobat or Adobe Reader? Some PDF viewers do not fully support XFA forms.

Also, if you are using Acrobat/Reader then check the preferences to make sure that Javascript is enabled:

Acrobat1.png

That should work,

Niall

Assure Dynamics