We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Product question: does Aspose support setting XMP metadata in EPS documents?

We’re looking for a library which we can use to set XMP metadata in EPS documents (at a document level, not an object level). Do any of the Aspose libraries offer this functionality?

@amytant

Could you please ZIP and attach your input and expected output EPS documents? We will then provide you more information on it.

@amytant

We have logged a feature request as PAGENET-344 in our issue tracking system to support setting XMP metadata in EPS document. We will inform you via this forum thread once this feature is available. We apologize for your inconvenience.

Thank you for logging this as a feature request. I have attached example input and expected out EPS documents. EPS_XMP.zip (449.0 KB)

In this attached example, the dc:title and xmp:MetadataDate properties within the XMP packet in the EPS document have been updated.

Further info on the feature request:

We want use a library to set metadata values in the XMP metadata of an input EPS document.

  1. If the input EPS document doesn’t contain an XMP packet, one is added before doing the previous steps.

  2. For each property value we wish to set in a namespace, we first check if the namespace exists within the XMP packet. If it doesn’t, it is added.

  3. Then we check if the property exists within the namespace, if it doesn’t the property is added to the namespace. Then its value is set.

To be clear, this is the same XMP functionality that is provided for image files in Aspose.Imaging, for PDF etc in Aspose.PDF and for PSD etc in Aspose.PSD. We are looking for feature parity with these other Aspose libraries for reading/writing XMP metadata in EPS files.

Documentation for how this works for EPS files is found in the XMP specifications. https://github.com/adobe/xmp-docs/blob/master/XMPSpecifications/XMPSpecificationPart3.pdf

@amytant

Thanks for sharing the detail. We have logged it in our issue tracking system. We will inform you via this forum thread once there is an update available on it.

I see that issue PAGENET-344 has been closed, does this mean that this feature will become available in Aspose?

@amytant

Your issue has been resolved and its fix is available in Aspose.Page for .NET 22.4. Please download it from here:

Download Aspose.Page for .NET 22.4

@tahir.manzoor Thank you for the information. We have begun testing the Aspose.Page.EPS.XMP library in Aspose.Page for .NET 22.4 with various EPS files and have encountered some major issues that currently prevent us from implementing this solution in our software.

Our test case: We load the EPS file, write some new properties in the DC namespace, overwrite dc:format and add a new namespace tmp, save the file, then load it again and check if everything has been saved in the file as expected.

Encountered issues:

After saving an EPS file with updated XMP metadata:

  1. Some EPS files seem to lose the initial file data. In some cases this is both the EPS data and the initial XMP metadata (if it wasn’t overwritten), then the output file only seems to contain the new XMP metadata. Otherwise the initial EPS data is gone but the initial XMP metadata’s still in the file. Aspose.Page can successfully load the file, but an EPS viewer just shows a blank image. See examples of input/output files for these cases in attachment OutputEPSFileLacksAllInputData.zip (1.8 MB)

  2. Some EPS files seem to lose the initial XMP metadata, but the file can be successfully loaded by Aspose.Page and successfully opened by an EPS viewer tool. See examples of input/output files for these cases in attachment OutputEPSFileLacksInitialXMPData.zip (4.3 MB)

Example code for updating the XMP metadata and saving the file with Aspose.Page:

> var value = <value>
> 
> using (System.IO.FileStream input = System.IO.File.OpenRead(localPath))
> {
> 	PsDocument psDocument = new PsDocument(input);
> 	XmpMetadata xmp = psDocument.GetXmpMetadata();
> 
> 	var epsDocumentNamespace = xmp.GetNamespaceUriByPrefix("dc");
> 
> 	if (String.IsNullOrEmpty(epsDocumentNamespace))
> 	{
> 		xmp.RegisterNamespaceUri("dc", "http://purl.org/dc/elements/1.1/");
> 	}
> 
> 	if (xmp.ContainsKey("dc:keywords"))
> 	{
> 		xmp["dc:keywords"] = value;
> 	}
> 	else
> 	{
> 		xmp.Add("dc:keywords", value);
> 	}
> 
> 	try
>     {
> 		using (System.IO.FileStream output = new System.IO.FileStream(action.OutputPath, FileMode.Create, FileAccess.Write))
> 		{
> 			psDocument.Save(output);
> 		}
> 	}
> 	finally
> 	{
> 		input.Close();
> 	}
> }

After saving an EPS file with updated XMP metadata and then attempting to load the EPS file and its XMP metadata:

  1. Some EPS files don’t seem to be able to be successfully loaded by Aspose.Page again. When attempting to load these files with the following code snippet, they never seem to finish loading and the memory usage keeps climbing by hundreds of megabytes while triggering garbage collection, leading to me believe there is some kind of stack overflow or memory leak bug happening. Could be related to the incorrect saving in issues 1-3. See examples in attachment OutputEPSFileCannotBeLoadedByAsposeAfterAsposeSave.zip (491.8 KB)

  2. Some EPS files don’t seem to be able to have their XMP metadata successfully loaded by Aspose.Page again. When attempting to load the files with the following code snippet, the load succeeds but the XMPMetadata object contains 0 results, though you can clearly see there are properties within the XMP packet. See examples of input/output files for these cases in attachment OutputEPSFileCannotHaveItsXMPLoadedByAspose.zip (965.2 KB)

Example code for loading the EPS file and its XMP metadata with Aspose.Page (after it’s already been previously updated and saved by Aspose.Page):

using (var stream = System.IO.File.OpenRead(localPath))
{
    PsDocument psDocument = new PsDocument(stream);
    XmpMetadata xmp = psDocument.GetXmpMetadata();
}

@amytant

We are working over your query and will get back to you soon.

@amytant

We have logged this problem in our issue tracking system as PAGENET-361. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor I see that issue PAGENET-361 has been closed, does this mean that the fix will be available in Aspose.Page for .NET 22.5?

@amytant

Yes, your understanding is correct. We will inform you via this forum thread once new release of Aspose.Page is available.