Adobe acrobat 7.0.5 sdk User Manual

Page of 122
XML and the Acrobat SDK
Converting PDF Documents to XML Format
8
76
Co nve r t i n g   P D F   D o c u m e n t s   t o   X M L   Fo r m a t
Because XML representation is the basis for the exchange of information with Web Services 
and enterprise infrastructures, it is often useful to convert your PDF documents into XML 
format.
Converting to XML Format Using Acrobat JavaScript
It is a straightforward process to do this using the 
doc
 object’s 
saveAs
 method, which not 
only performs the conversion to XML, but also to a number of other formats. 
To convert your PDF document to a given format, you must determine the device-
independent path to which you will save your file, and the conversion ID used to save in the 
desired format. For XML, the conversion ID is ”com.adobe.acrobat.xml-1-00”.
For more information, see the Acrobat JavaScript Scripting Guide and the Acrobat JavaScript 
Scripting Reference
.
The SaveAsXML Plug-in
SaveAsXML is a plug-in for Acrobat which extends the “Save as type” choices in the Save As 
dialog box to allow a Tagged PDF document to be saved as a number of XML, HTML, or 
similar text-based formats. 
Mapping Tables are used to control the conversion process for the SaveAsXML feature. The 
Mapping Tables are a script of hierarchically-organized directives written in a custom 
language defined in XML syntax. This allows developers to create custom Mapping Tables 
for formats other than those provided in this package. 
Overview of the SaveAsXML Process
When the SaveAsXML plug-in registers itself with Acrobat, it inspects the set of XML files in 
the MappingTables folder to determine the number of conversion services that are 
available.
The MappingTables folder must be found in the same folder as the 
SaveAsXML.ap
i file. 
Files in this folder are the only ones that are inspected as potential conversion services 
supported by the plug-in. This folder may not contain any files with the 
.xml
 extension 
that are not Mapping Tables.
If the registration process finds the Root element and its menu-name attribute, it adds the 
menu name to the list of file format choices available in the Save As dialog box. (The menu 
name must be unique in order to avoid confusion by similarly identified entries in the Save 
As
 dialog box’s file formats. )
For more complete examples of the usage of these directives, see the Mapping Tables 
distributed with SaveAsXML. Every directive that is currently supported has been used in 
one or more of these tables.