Skip to main content

pdf-xmp


Use the pdf-xmp endpoint to extract xmp meta-data from a PDF.

Use the pdf-xmp endpoint to extract xmp meta-data from a PDF. It uses an HTTP POST to send a PDF as binary and then returns the xmp metadata as an XML response. The pdf-xmp endpoint takes an HTTP POST form submission, where the PDF is sent as binary in the form's body.

info

Refer to the following Users Guide page if you require more information illustrating how to call the endpoint directly as a REST call.

Run In Postman

API

The PdfXmp class encapsulates the pdf-xmp endpoint. A PdfXmp instance takes an PdfResource instance. An PdfResource is constructed from a PDF coming from a file, a byte array, or stream.

public PdfXmp(PdfResource resource);

public class PdfResource : Resource
{
public PdfResource(string filePath, string resourceName = null);
public PdfResource(byte[] value, string resourceName = null);
public PdfResource(Stream data, string resourceName = null);
}
Source: PdfXmp.cs Source: PdfResource.cs

Example

A complete example is available via one of the following GitHub projects depending upon the language you wish to use.

LanguageGitHub Users Guide ProjectClassLocation/Package/Namespace
C#https://github.com/dynamicpdf-api/dotnet-client-examplesProgram.csnamespace PdfXmpExample
Gohttps://github.com/dynamicpdf-api/go-client-examplespdf-xmp-example.gogo-client-examples
Javahttps://github.com/dynamicpdf-api/java-client-examplesPdfXmpExample.javacom.dynamicpdf.client.examples
Node.jshttps://github.com/dynamicpdf-api/nodejs-client-examplesPdfXmpExample.jsnodejs-users-guide
PHPhttps://github.com/dynamicpdf-api/php-client-examplesPdfXmpExample.phpphp-client-examples
Pythonhttps://github.com/dynamicpdf-api/python-client-examplesPdfXmpExample.pypython-client-examples

The processing steps and syntax are similar for all five languages.

  • Create a new PdfXmp instance and pass a PdfResource instance containing the PDF.
  • Call the PdfXmp instance's Process method and the PDF's XMP metadata is returned as XML.
using DynamicPDF.Api;
using System;

namespace PdfXmpExample
{
class Program
{
static void Main(string[] args)
{
Run("DP.xxx-api-key-xxx", "C:/temp/dynamicpdf-api-usersguide-examples/");
}

public static void Run(String apiKey, String basePath)
{
PdfResource resource = new PdfResource(basePath + "/fw4.pdf");
PdfXmp pdfXmp = new PdfXmp(resource);
pdfXmp.ApiKey = apiKey;
XmlResponse response = pdfXmp.Process();
Console.WriteLine(response.Content);
}
}
}
Source: PdfXmpExample
   Follow us on social media for latest news!