←选择平台

AltoXmlDocumentOptions类

总结
提供使用ALTO(已分析的布局和文本对象)格式保存文档时使用的额外选项。
语法
c#
VB
objective - c
c++
Java
[SerializableAttribute ()][DataContractAttribute ()]公共AltoXmlDocumentOptions:DocumentOptions
< DataContractAttribute () >< SerializableAttribute () >公共AltoXmlDocumentOptions继承了DocumentOptions
@接口LTAltoXmlDocumentOptions: LTDocumentOptions 
公共AltoXmlDocumentOptions扩展DocumentOptions
[DataContractAttribute ()][SerializableAttribute ()]公共ref类AltoXmlDocumentOptions:公共DocumentOptions
讲话

属性中设置的选项AltoXmlDocumentOptions类保存文档时,将使用DocumentFormat。AltoXml格式。

修改Alto格式的选项,请执行以下步骤:

  1. 使用DocumentWriter。GetOptions方法DocumentWriter正在使用的对象。通过DocumentFormat。AltoXml格式参数。注意,结果对象来自基DocumentOptions类需要转换到AltoXmlDocumentOptions
  2. 使用各种AltoXmlDocumentOptions属性来更改选项。
  3. 使用DocumentWriter。setoption在引擎中设置新选项。
  4. 现在您可以调用DocumentWriter。BeginDocument方法(同样,使用DocumentFormat。AltoXml格式参数)来创建一个新文档并添加页面。

注意,这种格式不支持调用DocumentWriter。InsertPage

例子

这个例子将使用一些受支持的选项创建一个新的文本文件。

c#
VB
使用Leadtools.Document.Writer;使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Ocr;公共无效AltoXmlDocumentOptionsExample ()varinputFileName = Path.Combine(LEAD_VARS.ImagesDir,“ocr1.tif”);varoutputFileName = Path.Combine(LEAD_VARS.ImagesDir,“Example.xml”);//设置LEADTOOLS OCR引擎使用varocrEngine = OcrEngineManager.CreateEngine(ocrengintype . lead))ocrEngine。启动(, LEAD_VARS.OcrLEADRuntimeDir);//获取DocumentWriter实例vardocWriter =DocumentWriter ();//修改ALTO XML选项varaltoXmlOptions = docWriter.GetOptions(DocumentFormat.AltoXml)作为AltoXmlDocumentOptions;altoXmlOptions。文件名= inputFileName;altoXmlOptions。SoftwareCreator =“领导”docWriter.SetOptions (DocumentFormat。AltoXml altoXmlOptions);//创建一个文档使用varocrDocument = ocreengine . documentmanager . createdocument ())//添加图像varocrPage = ocrDocument.Pages.AddPage(inputFileName,);//识别ocrPage。识别();//保存为ALTO XMLocrDocument。保存(outputFileName DocumentFormat。AltoXml,);静态LEAD_VARS公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”公共常量字符串OcrLEADRuntimeDir =@“C: \ LEADTOOLS21 \ Bin \常见\ OcrLEADRuntime”
进口Leadtools.Document.Writer进口Leadtools进口Leadtools。编解码器进口Leadtools。光学字符识别公共AltoXmlDocumentOptionsExample ()昏暗的inputFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“ocr1.tif”昏暗的outputFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Example.xml”'设置LEADTOOLS OCR引擎使用ocrEngine作为IOcrEngine = OcrEngineManager.CreateEngine(ocrengintype . lead)ocrEngine。启动(没有什么没有什么没有什么LEAD_VARS.OcrLEADRuntimeDir)获取DocumentWriter实例昏暗的docWriter作为DocumentWriter ()“更改ALTO XML选项昏暗的altoXmlOptions作为AltoXmlDocumentOptions =DirectCast(docWriter.GetOptions (DocumentFormat.AltoXml)、AltoXmlDocumentOptions)altoXmlOptions。FileName = inputFileNamealtoXmlOptions。SoftwareCreator =“领导”docWriter.SetOptions (DocumentFormat。AltoXml altoXmlOptions)创建一个文档使用ocrDocument作为IOcrDocument = ocreengine . documentmanager . createdocument ()添加图片昏暗的ocrPage作为IOcrPage = ocrDocument.Pages.AddPage(inputFileName,没有什么承认它ocrPage。识别(没有什么将文档保存为ALTO XMLocrDocument。保存(outputFileName DocumentFormat。AltoXml,没有什么结束使用结束使用结束公共NotInheritableLEAD_VARS公共常量ImagesDir作为字符串“C: \ LEADTOOLS21 \ Resources \图片”公共常量OcrLEADRuntimeDir作为字符串“C: \ LEADTOOLS21 \ Bin \常见\ OcrLEADRuntime”结束
需求

目标平台

Leadtools.Document.Writer组装
188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领德科技有限公司版权所有。