Status Document Job Converter

StatusJobDataRunner has support for document conversion, along with status update. This feature utilizes LEADTOOLS caching to:

The main class for running a conversion with status is StatusJobDataRunner that uses instances of StatusJobData for each conversion. A simple workflow of an application using the status job converter is as follows:

// Create a new status job data and set its options 
var jobData = new lt.Document.DocumentConverterJobData(); 
jobData.documentFormat = lt.Document.Writer.DocumentFormat.pdf; 
// etc. 
// Run the conversion on an existing document in the cache 
// sourceDocumentId is the ID of an existing document in the cache 
lt.Document.Converter.StatusJobDataRunner.runConvertJob(sourceDocumentId, jobData) 

This workflow performs the conversion job but does not allow status information about the job to be obtained. To do that, modify the code as specified in the StatusJobDataRunner example.

When conversion starts, the runner will create a new cache item with Region/Key set to userToken/jobToken respectively, and the value set to a copy of the StatusJobData input object. As the job progresses, the runner will update this item in the cache with the latest status and timestamps. The application can use queryConvertJobStatus at any time to get the latest version of StatusJobData from the cache with updated values of the conversion status and any errors that might have occurred. The value of isCompleted is true when the runner has completed the conversion.

StatusJobData contains various members that can be organized into the following sections:

Status Section

Member Description
userToken and jobToken Unique identifiers for user and the job. These are used as the cache region and key to create a unique identifier for the job.
userData Any user-defined data associated with the job.
jobStatus Latest status of the job, whether it has started, completed, or aborted.
jobStatusMessage Extra information on the last job status.
isCompleted Determines whether the job has been completed.
abort Allows the user to abort a running job.
jobStartedTimestamp, jobCompletedTimestamp, jobStatusTimestamp, queryJobStatusTimestamp Timestamps of various job operations.
errorMessages Holds any error messages occurred during the conversion.

userToken and jobToken must be specified by the application (or set automatically by the StatusJobDataRunner class), and combining them should create a unique string. Internally, the runner will use userToken and jobToken as the Region and Key of a cache item added to the cache.

jobStatus will be set to one of the DocumentConverterJobStatus enumeration members.

jobStatusMessage will contain extra information about the last job status.

isCompleted will be false as long as the runner is performing the conversion. It is set to true when the job finishes (successfully or not: the status will contain Success or Aborted, depending on the result of the conversion). In case of errors, errorMessages contains helpful hints and messages for one or more errors that occurred.

The various timestamps can be queried to check the health of the conversion and whether it is still performing correctly.

Input Section

Member Description
inputDocumentId The ID of the source document to be converted.
inputDocumentFirstPageNumber, inputDocumentLastPageNumber Optional first and last page numbers of the document to be converted.

These members must be initialized to the information about the input document in the cache to be converted.

Output Section

Member Description
outputDocumentID Optional ID to use for the output document.
outputDocumentUri Uploaded URI to use for the output document.

The resulting output document from the conversion is uploaded to the cache. These members define how to store the document.

Conversion Section

Member Description
documentFormat, rasterImageFormat, rasterImageBitsPerPixel Format to use for the output document.
jobName Optional job name.
annotationsMode Annotation output mode.

Finally, this section specifies the output document type and annotation mode to use.

For a full example, refer to StatusJobDataRunner.

See Also

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS HTML5 JavaScript

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.