Add properties in XMP metadata of EPS | JavaScript

To add properties in XMP metadata of an EPS file, it is necessary to do several steps:

  1. Create file reader ‘const file_reader = new FileReader();’ and read file ‘file_reader.readAsArrayBuffer(e.target.files[0]);’.
  2. On load event handler call AsposeXMPAddSimpleProperties and pass the file content, his name, result file name, prefix, url, and property key and value to it.
  3. The result JSON contains the file name in fileNameResult.
  4. You can download files by using the DownloadFile function: ‘DownloadFile(JSON.fileNameResult, “image/pdf”);’ and display the result: ‘document.getElementById(‘output’).textContent = JSON.XMP;’


The following code snippet shows how to add an XML namespace in XMP metadata in an EPS file in JavaScript via C++:

 1  var fXMPAddSimpleProperties = function (e) {
 2    const file_reader = new FileReader();
 3    file_reader.onload = (event) => {
 4      const key = "tmp:newKey"
 5      const value = "NewValue"
 6      const JSON = AsposeXMPAddSimpleProperties(event.target.result, e.target.files[0].name, e.target.files[0].name + "_out.eps", key, value);
 7      if (JSON.errorCode == 0) {
 8          DownloadFile(JSON.fileNameResult, "image/eps");
 9      }
10      else 
11        document.getElementById('output').textContent = JSON.errorText;
12    }
13    file_reader.readAsArrayBuffer(e.target.files[0]);
14  }

See adding properties in XMP metadata in Java and .NET.

You can download examples and data files from GitHub.

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.