使用 NodeJS 从 EPS 文件获取 XMP 元数据
为了从 EPS 文件中提取 XMP 元数据,需要调用 AsposeEPSGetXMP 并将文件内容、文件名称和结果文件名传递给它。
如果 EPS 文件不包含 XMP 元数据,我们将获取一个新的文件,其中包含 PS 元数据注释中的值(%%Creator、%%CreateDate、%%Title 等)。
结果 JSON 在 fileNameResult 中包含文件名,并在 XMP 元素中获取元数据。
以下代码片段展示了如何在 NodeJS 中从 EPS 文件中提取 XMP 元数据:
1const AsposePage = require('asposepagenodejs');
2
3const ps_file = "./data/program_13.ps";
4
5console.log("Aspose.Page for Node.js via C++ examples.");
6
7AsposePage().then(AsposePageModule => {
8
9 const JSON = AsposePageModule.AsposeEPSGetXMP(ps_file, "result1.eps");
10 console.log("AsposeEPSGetXMP => %O", JSON.errorCode == 0 ? JSON.fileNameResult : JSON.errorText);
11
12},
13 reason => {console.log(`The unknown error has occurred: ${reason}`);}
14);
您可以从 GitHub下载示例和数据文件。