在电子邮件中附加动态生成的pdf的最佳方法是什么? 我目前正在使用itext7 api从html生成pdf。下面是代码片段:
public void downloadPdf(final SlingHttpServletRequest request,final SlingHttpServletResponse response) {
final String pdfHtml = getPdfHtml(request);
LOGGER.debug("*****Inside method downloadPdf******");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition","attachment;filename=xyz.pdf");
try {
HtmlConverter.convertToPdf(pdfHtml,response.getOutputStream());
} catch (final Exception e) {
LOGGER.error("Exception occured while converting html to pdf",e);
}
}
我实际上想在用户单击“通过电子邮件获取”按钮时通过电子邮件发送该pdf。 我应该将pdf存储在一个临时位置,获取并通过电子邮件发送,还是有其他出路?
预先感谢