The following table lists the default values of the AltoXmlDocumentOptions properties:
Property | Value |
---|---|
MeasurementUnit | AltoXmlMeasurementUnit.MM10 |
FileName | null |
ProcessingDateTime | null |
ProcessingAgency | null |
ProcessingStepDescription | null |
ProcessingStepSettings | null |
SoftwareCreator | null |
SoftwareName | null |
SoftwareVersion | null |
ApplicationDescription | null |
FirstPhysicalPageNumber | 1 |
Formatted | false |
Indentation | " " |
Sort | false |
PlainText | false |
ShowGlyphInfo | false |
ShowGlyphVariants | false |
using Leadtools.Document.Writer;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Ocr;
public void AltoXmlDocumentOptionsExample()
{
var inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr2.tif");
var outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "out_Example.xml");
// Setup LEADTOOLS OCR engine
using (var ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD))
{
ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir);
// Get the DocumentWriter instance
var docWriter = new DocumentWriter();
// Change the ALTO XML options
var altoXmlOptions = docWriter.GetOptions(DocumentFormat.AltoXml) as AltoXmlDocumentOptions;
altoXmlOptions.FileName = inputFileName;
altoXmlOptions.SoftwareCreator = "LEAD";
docWriter.SetOptions(DocumentFormat.AltoXml, altoXmlOptions);
// Create a document
using (var ocrDocument = ocrEngine.DocumentManager.CreateDocument())
{
// Add the image
var ocrPage = ocrDocument.Pages.AddPage(inputFileName, null);
// Recognize it
ocrPage.Recognize(null);
// Save the document as ALTO XML
ocrDocument.Save(outputFileName, DocumentFormat.AltoXml, null);
}
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime";
}