在 EPS 的 XMP 元数据中添加数组项 | Node.js
要在 EPS 文件的 XMP 元数据中添加数组项,需要调用 AsposeXMPAddArrayItem 并将文件内容、文件名称和结果文件名传递给它。
如果 EPS 文件不包含 XMP 元数据,我们将获取一个新的 XMP 元数据,其中包含 PS 元数据注释中的值(%%Creator、%%CreateDate、%%Title 等)。
结果 JSON 在 fileNameResult 中包含文件名,并在 XMP 元素中获取元数据。
以下代码片段展示了如何在 Node.js 中向 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 input = [
10 ["dc:title", "NewTitle"],
11 ["dc:creator", "NewCreator"]
12 ];
13 const JSON = AsposePageModule.AsposeXMPAddArrayItem(ps_file, "result2.eps", input);
14 console.log("AsposeXMPAddArrayItem => %O", JSON.errorCode == 0 ? JSON.fileNameResult : JSON.errorText);
15
16},
17 reason => {console.log(`The unknown error has occurred: ${reason}`);}
18);
您可以从 GitHub下载示例和数据文件。