Skip to main content

Extract XMP Metadata

Extract XMP meta-data from PDF documents using the `pdf-xmp` endpoint.

The pdf-xmp endpoint is for extracting XMP meta-data from PDF documents. In this tutorial we demonstrate just how easy it is to extract XMP meta-data from a PDF document via the pdf-xmp endpoint. We first call the pdf-xmp endpoint directly using REST.

We then use the DynamicPDF client libraries to illustrate using pdf-xmp with the C#, Java, Node.js, and PHP client libraries.

Required Resources

To complete this tutorial, you must add the Get XMP Metadata sample to your samples folder in your cloud storage space using the File Manager. After adding the sample resources, you should see a samples/get-xmp-metadata-pdf-endpoint folder containing the resources for this tutorial.

SampleSample FolderResources
Get XMP Metadatasamples/get-xmp-metadata-pdf-endpointfw4.pdf
  • From the File Manager, download fw4.pdf to your local system; here we assume /temp/dynamicpdf-api-samples/get-xmp-metadata.
  • After downloading, delete fw4.pdf from your cloud storage space using the File Manager.

See Sample Resources for instructions on adding sample resources.

Obtaining API Key

This tutorial assumes a valid API key obtained from the DynamicPDF API's Portal. Refer to the following for instructions on getting an API key.


If you are not familiar with the File Manager or Apps and API Keys, refer to the following tutorial and relevant Users Guide pages.

Calling API Directly Using POST

The pdf-xmp endpoint takes a POST request. When using cURL, you specify the endpoint, the HTTP command, the API key and the local resources required. The following cURL command illustrates.

  • Create a cURL POST request, where you pass the API key as a header and the PDF as binary data.
curl -X POST "" 
-H "Content-Type: application/pdf"
-H "Authorization: Bearer"
--data-binary "@c:/temp/dynamicpdf-api-samples/get-xmp-metadata/fw4.pdf"
  • Execute the cURL command and the XML metadata is written to the commandline.
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47 ">
<rdf:RDF xmlns:rdf="">
<rdf:Description rdf:about=""
<rdf:li xml:lang="x-default">Employee's Withholding Certificate</rdf:li>
<rdf:li xml:lang="x-default">2021 Form W-4</rdf:li>
<rdf:Description rdf:about=""
<xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool>
<rdf:Description rdf:about=""
<pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer>
<rdf:Description rdf:about=""
<rdf:Description rdf:about=""
<desc:embeddedHref rdf:parseType="Resource">
<?xpacket end="w"?>

Calling Endpoint Using Client Library

To simplify development, you can also use one of the DynamicPDF API client libraries. Use the client library of your choice to complete this tutorial section.

Complete Source

You can access the complete source for this project at one of the following GitHub projects.

LanguageFile NameLocation (package/namespace/etc.)GitHub Project

Click on the language tab of choice to view the tutorial steps for the particular language.

Available on NuGet:

Install-Package DynamicPDF.API
  • Create a new Console App (.NET Core) project named GetXmpMetaData.
  • Add the DynamicPDF.API NuGet package.
  • Create a new static method named Run.
  • Add the following code to the Run method.
  • Create a new PdfXmp instance and PdfResource instance with the path to the PDF in its constructor.
  • Add a call to the Process method in the PdfXmp instance.
  • Ensure the call was successful and add code to print the results to the console.
  • Run the application and the XML metadata is printed to the console.
using DynamicPDF.Api;
using System;

namespace GetXmpMetaData
class Program
static void Main(string[] args)
Run("", "C:/temp/dynamicpdf-api-samples/get-xmp-metadata");

public static void Run(String apiKey, String basePath)
//get the local pdf as pdf resource
PdfResource resource = new PdfResource(basePath + "/fw4.pdf");

//load the pdf and call the endpoint
PdfXmp pdfXmp = new PdfXmp(resource);
pdfXmp.ApiKey = apiKey;
XmlResponse response = pdfXmp.Process();

//if successful print results to console
if (response.IsSuccessful)

In all six languages, the steps were similar. First, we created a new PdfResource instance by loading the path to the PDF via the constructor. Next, we created a new instance of the PdfXmp class, which abstracts the pdf-xmp endpoint. Then the PdfXmp instance prints the XML metadata after processing. Finally, we called the Process method and printed the resultant XML to the console.

   Follow us on social media for latest news!