在 EPS 的 XMP 元数据中添加 XML 命名空间 | NodeJS
要在 EPS 文件的 XMP 元数据中添加 XML 命名空间,需要调用 AsposeXMPAddNamespace 并传递文件内容、文件名称、结果文件名、前缀、URL 以及新命名空间的键值对数组。
结果 JSON 包含 fileNameResult 中的文件名。
以下代码片段展示了如何在 NodeJS 中在 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 prefix = "tmp";
10 const url = "http://www.some.org/schema/tmp#";
11 const input = [
12 ["tmp:newKey", "NewValue"]
13 ];
14 const JSON = AsposePageModule.AsposeXMPAddNamespace(ps_file, "result4.eps", prefix, url, input);
15 console.log("AsposeXMPAddNamespace => %O", JSON.errorCode == 0 ? JSON.fileNameResult : JSON.errorText);
16
17},
18 reason => {console.log(`The unknown error has occurred: ${reason}`);}
19);
您可以从 GitHub下载示例和数据文件。