问题
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..?
回答1:
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 )
来源:https://stackoverflow.com/questions/32201313/how-can-i-generate-byte-array-from-an-odt-file-java