use of com.cehome.apimanager.pdf.exception.DocumentGeneratingException in project api-manager by cehome-com.
the class PdfDocumentGenerator method generate.
public boolean generate(String template, DocumentVo documentVo, String outputFile) throws DocumentGeneratingException {
Map<String, Object> variables = new HashMap<String, Object>();
try {
variables = documentVo.fillDataMap();
String htmlContent = this.htmlGenerator.generate(template, variables);
this.generate(htmlContent, outputFile);
logger.info("The document [primarykey=" + documentVo.findPrimaryKey() + "] is generated successfully,and stored in [" + outputFile + "]");
} catch (Exception e) {
String error = "The document [primarykey=" + documentVo.findPrimaryKey() + "] is failed to generate";
logger.error(error);
throw new DocumentGeneratingException(error, e);
}
return true;
}
Aggregations