I have two data sources from two different tables and i want to pass for templates
How i achieve this .
Pls find program for reference. I am getting documnets and dataSource from Database .
I want to pass to excute method so that while generation of template. it will get injected
ApiResponse<Template> response = new ApiResponse<>();
Template template = dao.getLatestTemplate(templateID);
Document doc = new Document(new ByteArrayInputStream(template.getTemplateData()));
doc.getMailMerge().setUseNonMergeFields(true);
List<Document> documents = new ArrayList<Document>();
documnets = dao.getDocuments();
DataSource dataSource = dao.getTemplateData();
doc.getMailMerge().execute(dataSource);
PdfSaveOptions pso = new PdfSaveOptions();
pso.setCompliance(PdfCompliance.PDF_17);
Document doc2 = new Document(new ByteArrayInputStream(template.getTemplateData()));
doc.appendDocument(doc2, ImportFormatMode.KEEP_SOURCE_FORMATTING);
doc.save("I:/ASPOSE-TEMPLATES/Doc/ASPOSE-Docx-To-PDF.pdf", pso);
response.setMessage("PDF Generated Successfully ");
return response;