I want to show a PDF with one jrxml into the JasperServer (this is simple). But then, when the user click on "Export to PDF" I need to show some more fields in the generated PDF.
I don´t know If I can upload 2 different jrxml (one to show it and one to export it), or if I can pass a parameter so the jasper will know if it has to print the added fields.
You could try to use the net.sf.jasperreports.export.{format}.exclude.key.{suffix}
The strategy would be to exclude the fields (reportElements) from all other export types then pdf
<jasperReport ...>
<property name="net.sf.jasperreports.export.html.exclude.key.myField"/>
<property name="net.sf.jasperreports.export.graphics2d.exclude.key.myField"/>
....
<textField>
<reportElement key="myField" x="45" y="35" width="125" height="20" uuid="5c2bb49a-ba95-4cb7-8c46-c32a0769e5e9"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{field1}]]></textFieldExpression>
</textField>
</jasperReport>