@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
PdfWriter pdfWriter = new PdfWriter(response.getOutputStream());
PdfDocument pdf = new PdfDocument(pdfWriter);
Document doc = new Document(pdf);
with the above code, I am rendering a pdf as an html response. When I do that, I also want to save this to the database. How should I do it?
Should I create another byte stream and redo the same steps?
PdfWriter
to aByeArrayOutputStream
and write the resulting byte array to all outputs you want your pdf to go to, or use something like explained in answers to this question.