Arbotext Publishing Engine Programmer's Guide (《Arbortext Publishing Engine 程序员指南》) > The Arbortext Publishing Engine Sub-Process > Writing Arbortext PE 应用程序s in JavaScript > Calling the Conversion Processor from a JavaScript Arbortext PE 应用程序
  
Calling the Conversion Processor from a JavaScript Arbortext PE 应用程序
You can write a JavaScript application that can call the conversion processor (explained in Arbortext Publishing Engine Document Conversion). The Arbortext PE 子进程 use the Rhino package to allow JavaScript to access Java objects. Refer to the Calling the Conversion Processor From a Java Arbortext PE 应用程序 for an explanation of the Java objects used to invoke the conversion processor. Each parameter entry must correspond to a valid conversion parameter (see Document Conversion Parameters for a list and descriptions).
The following is an example of JavaScript code that calls com.arbortext.e3.DocumentConverter.doConvert:
var inFile = "c:\absolute\path\to\input\file.xml";
var outFile = "c:\absolute\path\to\output\file.pdf";
var params = new java.util.HashMap();
params.put( "type", "pdf" );
params.put( "stylesheet" , "d:\absolute\path\to\stylessheet.style" );
try {
com.arbortext.e3.subprocess.DocumentConverter.doConvert(
inFile, outFile, params );
// Conversion succeeded
}
catch( e ) {
var reason = e.getReason();
var page = e.getPage();
// Log the failure and exit.
}