You can use the XMP Utilities Java
and web service APIs to programmatically retrieve and save XMP metadata
from a PDF document.
Summary of steps
To export XMP metadata from a PDF document, perform the
following steps:
-
Include project files.
-
Create an XMPUtilityService client.
-
Invoke the XMP metadata export operation.
Include project files
Include necessary files into your development
project. If you are creating a client application using Java, include
the necessary JAR files. If you are using web services, ensure that
you include the proxy files.
Create an XMPUtilityService client
Before you can programmatically
perform an XMP Utilities operation, you must create an XMPUtilityService
client. With the Java AP,I this is accomplished by creating an
XMPUtilityServiceClient
object.
With the web service API, this is accomplished using an
XMPUtilityServiceService
object.
Invoke the XMP metadata export operation
After you create the
service client, you can invoke one of the XMP metadata export operations,
which can be used to inspect the XMP metadata or save it to disk.
Export XMP metadata using the Java API
Export XMP metadata by using the XMP Utilities API (Java):
-
Include project files
Include client JAR files,
such as adobe-pdfutility-client.jar, in your Java project’s class
path.
Note:
The adobe-pdfutility-client.jar file
contains classes that enable you to programmatically invoke the
XMP Utility service.
-
Create an XMPUtilityService client
Create an
XMPUtilityServiceClient
object
by using its constructor and passing a
ServiceClientFactory
object
that contains connection properties.
-
Invoke the XMP metadata import operation
To inspect
the XMP metadata, invoke the
XMPUtilityServiceClient
object’s
exportMetadata
method
and pass in a
com.adobe.idp.Document
object that
represents the PDF file. The method returns an
XMPUtilityMetadata
object
that contains the retrieved metadata.
To retrieve and save
the XMP metadata, invoke the
XMPUtilityServiceClient
object’s
exportXMP
method
and pass in a
com.adobe.idp.Document
object that
represents the PDF file. The method returns a
com.adobe.idp.Document
object
that contains the retrieved metadata, which you can subsequently
save to disk as an XML file.
Export XMP metadata using the web service API
Export XMP metadata by using the XMP Utilities API (web
service):
-
Include project files
-
Create an XMPUtilityService client
Create an
XMPUtilityServiceService
object
by using your proxy class constructor.
-
Invoke the XMP metadata import operation
To inspect
the XMP metadata, invoke the
XMPUtilityServiceClient
object’s
exportMetadata
method
and pass in a
BLOB
object that represents the PDF
file. The method returns an
XMPUtilityMetadata
object that
contains the retrieved metadata.
To retrieve and save the
XMP metadata, invoke the
XMPUtilityServiceClient
object’s
exportXMP
method
and pass in a
BLOB
object that represents the PDF
file. The method returns a
BLOB
object that contains
the retrieved metadata, which you can subsequently save to disk as
an XML file.
|
|
|