How can I generate Byte array from an ODT file java

穿精又带淫゛_ 提交于 2019-12-25 13:15:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!