从PDF文件导出数据到XML(外观)
Contents
[
Hide
]
Form 类允许您使用 exportXml 方法从 PDF 文件中导出数据到 XML 文件。为了将数据导出到 XML,您需要创建一个 Form 类的对象,使用 bindPDF 方法打开源 PDF 表单,然后使用 OutputStream 对象调用 exportXml 方法。最后,您可以关闭 OutputStream 对象并处理 Form 对象。以下代码片段展示了如何将数据导出到 XML 文件。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java | |
// open document | |
Form form = new Form(); | |
form.bindPdf("student.pdf"); | |
// create XML file. | |
OutputStream xmlOutputStream = new FileOutputStream("student.xml"); | |
// export data | |
form.exportXml(xmlOutputStream); | |
// close file stream | |
xmlOutputStream.close(); | |
// dispose the form object | |
form.dispose(); |