Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从包含我需要填充的字段的 ODT 模板文件生成 PDF。
我想获取这个 ODT 模板的字节数组,它存在于我的项目的根文件夹中。我的应用程序是这样一种方式,即提供字节数组来生成 PDF。
是否有任何特定方法可以生成字节数组而不会丢失模板的属性..?
试试这个可以帮助你:
URL url = this.getClass().getResource("/your_file"); File templateFile = new File(url.toURI()); org.apache.commons.io.FileUtils.readFileToByteArray(templateFile )