You can make use of JasperReport utility of java. In that what you need to do is create one standard Jasper template (.jasper extension file) where you can configure as many field you want and fill that report run time using java code while keep things fixed like your name,address that you dont need to feel with every user request when you got your user request object.
Jasper has the facility to fill this template in backend and it allows you to generate pdf run time which you can attach in email response where you want.
Firstly, the input JSON:
{
"userName": "Evil Raat",
"details": {
"email": "not_really@test.com"
}
}
Then create a JSON DataSource in iReport Designer and point it at your file (leaving all the other details as their defaults)
Next you can use the following jrxml template to render the above JSON into a report:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sample" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a894078a-929b-4aae-a1d0-46485f0f8835">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="userName" class="java.lang.String">
<fieldDescription><![CDATA[userName]]></fieldDescription>
</field>
<field name="userEmail" class="java.lang.String">
<fieldDescription><![CDATA[details.email]]></fieldDescription>
</field>
<title>
<band height="200" splitType="Stretch">
<textField>
<reportElement uuid="3b74775b-4555-43c3-bdf2-1677145c8660" x="0" y="31" width="555" height="20"/>
<textElement textAlignment="Right">
<font fontName="Helvetica" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{userName}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="aa6cc7c8-2ca1-4f0f-92e2-c466083daba0" x="0" y="54" width="555" height="20"/>
<textElement textAlignment="Right">
<font fontName="Helvetica" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{userEmail}]]></textFieldExpression>
</textField>
</band>
</title>
</jasperReport>
Than you can create code like ,
Resource resource = new ClassPathXmlApplicationContext().getResource("classpath:reports/project.jrxml");
JsonDataSource ds = new JsonDataSource(new File("c:\myjson.json"));
jasperDesign = JRXmlLoader.load(resource.getInputStream());
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds);
JasperExportManager.exportReportToPdfFile(jasperPrint, destination+fileName+".pdf");
In above code i have use .json file as source of data to fill report. You can runtime generate json and provide it while filling report.