Add XMP metadata to EPS file using NodeJS
In order to add XMP metadata to an EPS file, it is necessary to call AsposeEPSGetXMP and pass the file content, its name, and the result file name to it.
If the EPS file doesn’t contain XMP metadata, we get a new one filled with values from PS metadata comments (%%Creator, %%CreateDate, %%Title, etc).
The result JSON contains the file name in fileNameResult and gets metadata in the XMP element.
The code snippet below shows how to add XMP metadata to EPS file in NodeJS:
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);
You can download examples and data files from GitHub.