I would like to cache a PDF template in a servlet’s context. Every time someone wants to generate a report the servlet will grab the template from the context, copy it then modify the copy with dynamic data. This will keep the application from hitting the hard drive every time a report is generated.
This is one way that I tried but does not seem to work. I get a null pointer error
RandomAccessFileOrArray pdfTemplate = new RandomAccessFileOrArray(
context.getResourceAsStream("pathToPdf"));
context.setAttribute("pdftemplate", pdfTemplate);
Any suggestions would be greatly appreciated. I have google searched this and cannot find any examples on the best way to code this.
Thanks for your time
Doug
I created Some PDF Templates and stored them in the Servlets context and it works fine.