Document converter job.
public class DocumentConverterJob
To run a job with DocumentConverter, first initialize a new DocumentConverterJobData object with the job's parameters (input document or file name, pages, output format, output file name, options annotations, etc.), then use CreateJob object. Finally pass this job to either DocumentConverterJobs.RunJob or DocumentConverterJobs.RunJobAsync.
The job instance can also be tracked and obtained through the DocumentConverterJobs.JobStarted, DocumentConverterJobs.JobOperation and DocumentConverterJobs.JobCompleted, events through the event data (DocumentConverterJobEventArgs.Job).
Status will contain the final status of the job when it finishes running. If the value is not DocumentConverterJobStatus.Success, then errors might have occurred and these errors are added to the Errors list.
When the job finishes, the ConversionModes property will contain the modes used during this job processing and the value of OutputFiles will contain a list of all the output files generated during the conversion.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Document.Writer;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
using Leadtools.Document;
using Leadtools.Caching;
using Leadtools.Annotations.Engine;
using Leadtools.Ocr;
using Leadtools.Document.Converter;
using Leadtools.Annotations.Rendering;
public void DocumentConverterJobsRunJobExample()
{
using (DocumentConverter documentConverter = new DocumentConverter())
{
var inFile = Path.Combine(ImagesPath.Path, @"Leadtools.doc");
var outFile = Path.Combine(ImagesPath.Path, @"output.tif");
var format = RasterImageFormat.Tif;
var jobData = DocumentConverterJobs.CreateJobData(inFile, outFile, format);
jobData.JobName = "conversion job";
var job = documentConverter.Jobs.CreateJob(jobData);
documentConverter.Jobs.RunJob(job);
if (job.Status == DocumentConverterJobStatus.Success)
{
Console.WriteLine("Success");
}
else
{
Console.WriteLine("{0} Errors", job.Status);
foreach (var error in job.Errors)
{
Console.WriteLine(" {0} at {1}: {2}", error.Operation, error.InputDocumentPageNumber, error.Error.Message);
}
}
}
}