How can we hide fields on print

We have some fields that we have set to not display on the form.

However, when we print the fields are visible.... How can we set these fields to not be printed?

You can hide them with CSS and Media Types

Thanks Javier

Is this the "supported" and official way of doing it?

Right now we use the onShow event of a field to make it hidden with

item.setVisible(false);

This will hide the field in the UI. But it still appears in the print.

I understand that we could create a CSS class "hidden" with a display:none and that would also hide the element for print (and display - so we shouldn't use the above method).

Just trying to figure out the "best way" of doing this instead of "hacking around" ;-)

Hmmm.... using CSS is a pain in Volt.

Experience so far:

I created an external css file where I had one selector:

.hidden {
display:none;
}

Then I imported it as a custom stylesheet and went to the field that I want to hide and set the "Custom CSS class name" to "hidden".

This works when viewing the document - but in the generated print output there is an entire row with the field and value shown :-(

Obviously, I can hide that by creating a CSS selector for that particular field in the external CSS and import it again.... But that really is not a solution.

Other suggestions?

Ok, so I have a "workaround" using rules - but kind of "silly" 🙃

Is there a way to specify just "true" for hide - instead of this silly rule?