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

Free Support Forum - aspose.com

Add XMP MetaData to a PDF file using Aspose.PDF

Hello there,

I am really struggling with add XMP metadata to a pdf file.
I am using old version of ASPOSE.PDF and I cannot change the version to latest.
version:3.8 Runtime version: 2.0.50727
I am using below code but it is not working:

FileStream stream = new FileStream(“C:\WS\mysample.pdf”,FileMode.Append);<o:p></o:p>

Aspose.Pdf.Pdf pdf = new Pdf(stream);

XmpMetadata xmpdata = new XmpMetadata();

xmpdata.AddUserProperty("xmlns", "mykey", "myvalue");

pdf.XmpMetadata = xmpdata;


Can anyone please help me on this, its really urgent..

Hi there,

Thanks for your inquriy. I am afraid you are using a quite old version. Please note we maintain a single code base of Aspose.Pdf, so all the fixes and new features/enhancements are implemented in latest version of DLL. It is recommended to download and try latest release of Aspose.Pdf, it will fix the reading and adding XMP data issue.

Furthermore, for migration to latest version, please check documentation link for migrating from older version of Aspose.Pdf. There are no major changes, you can check API changes section for the purpose. Almost all the object names and functionalities are same except Pdf and Section object these are replaced with Document and Page object respectively.

We are sorry for the inconvenience caused.

Best regards,


Thanks for the information.
There is will a huge change in the current project if I use the latest version.
Can you please tell us the version nearest to version 3.8 which will support both XMP data and Pdf and Section object ?


Thanks for the acknowledgement.

The version of API which you have specified is quite old (published somewhere around 2008) and I am afraid we might not be able to confirm the release close to that release where requested feature works correctly. However there can be some specific scenarios where API is not performing well but still, we might not be able to fix the issues in older release. Furthermore, during my testing with latest release where I have used the code snippet based on legacy Aspose.Pdf.Generator, I have managed to reproduce the same problem that MetaData is not being added. But I am afraid we might not be able to fix issues in legacy Aspose.Pdf.Generator part.

However during my testing with code snippet based on new Document Object Model of Aspose.Pdf namespace, I have noticed that MetaData is properly being added. Please try using the latest release and follow the instructions specified over Set XMP Metadata in a PDF document.