在 EPS 的 XMP 元数据中添加属性 | Node.js
为了在 EPS 文件的 XMP 元数据中添加属性,需要调用 AsposeXMPAddSimpleProperties 并传入文件内容、文件名称、结果文件名、前缀、URL 以及属性键和值。
结果 JSON 包含 fileNameResult 中的文件名。
以下代码片段展示了如何在 Node.js 中向 EPS 文件的 XMP 元数据添加 XML 命名空间:
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 key = "tmp:newKey"
10 const value = "NewValue"
11 const JSON = AsposePageModule.AsposeXMPAddSimpleProperties(ps_file, "result5.eps", key, value);
12 console.log("AsposeXMPAddSimpleProperties => %O", JSON.errorCode == 0 ? JSON.fileNameResult : JSON.errorText);
13
14},
15 reason => {console.log(`The unknown error has occurred: ${reason}`);}
16);
您可以从 GitHub下载示例和数据文件。