I am trying to generate a PDF from an ODT template file which contain the fields i need to populate.
I wanted to get the byte array of this ODT template which is present in the root folder of my project. My application is in such a way that the byte array is provided to generate the PDF.
Is there any specific method to generate the byte array without losing the properties of the template..?
解决方案
Try this may help you :
URL url = this.getClass().getResource("/your_file");
File templateFile = new File(url.toURI());
org.apache.commons.io.FileUtils.readFileToByteArray(templateFile )