Error processing SSI file
LEADTOOLS Leadtools.Documents (Leadtools.Documents assembly)

Convert Method

Show in webframe
Example 
The job data.
Converts this document to any supported format using SVG, OCR and Raster technologies.
Syntax
 function Leadtools.Documents.Document.convert( 
   jobData 
)

Parameters

ParameterTypeDescription
jobDataDocumentConverterJobDataThe job data.

Return Value

TypeDescription
jQueryApi.IDeferred A Promise object that may resolve succesfully to an object of type DocumentConvertResult object.
Remarks

The Convert method allows conversion the document to any of the supported formats with minimal amount of code.

The output document types can be any type of file formats supported by LEADTOOLS. but not limited to:

The Convert method will analyze the input and output documents types and then automatically uses a combination of the LEADTOOLS Raster, SVG and OCR engines to convert the data using the best possible combination of accuracy and speed. Each conversion operation is called a Document Converter Job in the framework.

Example
function convertDocumentExample() {
   // Load a new document
   var url = "http://demo.leadtools.com/images/pdf/leadtools.pdf";
   console.log("Loading document ...");
   lt.Documents.DocumentFactory.loadFromUri(url, null)
      .done(function (document) {
         console.log("Loaded, converting...");
         // Convert this document to Microsoft Word DOCX format
         var jobData = new lt.Documents.DocumentConverterJobData();
         jobData.documentFormat = lt.Documents.Writers.DocumentFormat.docx;
         jobData.rasterImageFormat = lt.Documents.RasterImageFormat.unknown;
         // Set document options
         var docxOptions = new lt.Documents.Writers.DocxDocumentOptions();
         docxOptions.textMode = lt.Documents.Writers.DocumentTextMode.auto;
         jobData.documentOptions = docxOptions;
         document.convert(jobData)
            .done(function (result) {
               console.log("Converted...");
               // Show it in a new tab
               // This is generic code, we know the result is in "document" since DOCX supports that
               // But this code checks if the results have been archived into a ZIP file if this
               // example was converting to, say SVG
               var resultDocument = result.document != null ? result.document.url : result.archive.url;
               window.open(resultDocument);
            })
            .fail(function (jqXHR, statusText, errorThrown) {
               alert("Error converting document " + errorThrown);
            });
      })
      .fail(function (jqXHR, statusText, errorThrown) {
         alert("Error loading document " + errorThrown);
      });
}
See Also

Reference

Document Object
Document Members

Error processing SSI file