Hi,
a very simple way is a recursive function like this one. It finds all fields in the form that aren't visible and changes them to be visible:
function changeFields (oNode) {
if (oNode.className === "field") {
if (oNode.presence !== "visible") {
oNode.presence = "visible";
}
}
for (var i = 0; i < oNode.nodes.length; i += 1) {
changeFields(oNode.nodes.item(i));
}
}
changeFields(xfa.form);
The real challenge will be to find out, which fields to hide again after printing the form.