本文整理汇总了C#中IEngine.CreateImageModification方法的典型用法代码示例。如果您正苦于以下问题:C# IEngine.CreateImageModification方法的具体用法?C# IEngine.CreateImageModification怎么用?C# IEngine.CreateImageModification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEngine
的用法示例。
在下文中一共展示了IEngine.CreateImageModification方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: How_to_save_images_for_document_fields_LPAREN2RPAREN
// HOW-TO: Save images for document fields
public static void How_to_save_images_for_document_fields_LPAREN2RPAREN( IEngine engine )
{
// If your development tool does not have rich functionality for working with
// images you can try using WriteToFile method of Image object as follows
trace( "Prepare a sample document..." );
IDocument document = PrepareNewRecognizedDocument( engine );
trace( "Select an arbitrary field..." );
IField field = document.Sections[0].Children[0];
assert( field.Name == "InvoiceNumber" );
trace( "Get the region and the page index for the field..." );
// Generally a field might correspond to several regions (blocks) on the same page or on
// different pages. Simple fields (simple picture or single line text)usually have one region
assert( field.Blocks.Count == 1 );
IBlock firstBlock = field.Blocks.Item( 0 );
int pageIndex = firstBlock.Page.Index;
IRegion region = firstBlock.Region;
// Knowing the field's page index and geometry we can "scroll" to the field image
// in a custom document view, or extract the region from the page image and use it
// as required. In this example we will use this information to save the field image
// to a file
trace( "Get the page image..." );
IPage page = document.Pages[pageIndex];
// Get the page image in .NET Framework format
IImageDocument pageImageDocument = page.ReadOnlyImage;
IImage bwImage = pageImageDocument.BlackWhiteImage;
trace( "Extract the field image..." );
IImageModification modification = engine.CreateImageModification();
modification.ClipRegion = region;
bwImage.WriteToFile( SamplesFolder + "\\FCEExport\\InvoiceNumber.tif",
ImageFileFormatEnum.IFF_Tif, modification, ImageCompressionTypeEnum.ICT_CcittGroup4, null );
}