使用 NodeJS 将 XMP 元数据添加到 EPS 文件

为了将 XMP 元数据添加到 EPS 文件,需要调用 AsposeEPSGetXMP 并将文件内容、文件名称和结果文件名传递给它。

如果 EPS 文件不包含 XMP 元数据,我们将获取一个新的文件,其中包含 PS 元数据注释中的值(%%Creator、%%CreateDate、%%Title 等)。

结果 JSON 在 fileNameResult 中包含文件名,并在 XMP 元素中获取元数据。


以下代码片段展示了如何在 NodeJS 中将 XMP 元数据添加到 EPS 文件:

 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    //If EPS file doesn't contain XMP metadata we get new one filled with values from PS metadata comments (%%Creator, %%CreateDate, %%Title etc).
10    const JSON = AsposePageModule.AsposeEPSGetXMP(ps_file, "result1.eps");
11    console.log("AsposeEPSGetXMP => %O",  JSON.errorCode == 0 ? JSON.fileNameResult : JSON.errorText);
12
13},
14    reason => {console.log(`The unknown error has occurred: ${reason}`);}
15);

请参阅在 Java.NET 中添加 XMP 元数据。

您可以从 GitHub下载示例和数据文件。

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.