public MasterForm() { _image = null; _attributes = new FormRecognitionAttributes(); _properties = FormRecognitionProperties.Empty; _processingPages = null; }
private FormRecognitionAttributes PrepareNewForm(ImageInfo ofi, Stopwatch stopWatch, FilledForm newForm) { try { FormRecognitionAttributes filledFormAttributes = RecognitionEngine.CreateForm(null); ofi.Image.ChangeViewPerspective(RasterViewPerspective.TopLeft); logger.Info($"{stopWatch.ElapsedMilliseconds} change view"); for (int i = 0; i < ofi.Image.PageCount; i++) { ofi.Image.Page = i + 1; //Add each page of the filled form to the recognition engine RecognitionEngine.AddFormPage(filledFormAttributes, ofi.Image, null); } logger.Info($"{stopWatch.ElapsedMilliseconds} closing form"); RecognitionEngine.CloseForm(filledFormAttributes); logger.Info($"{stopWatch.ElapsedMilliseconds} closed form"); CreateFormForRecognition(newForm, FormsRecognitionMethod.Complex); logger.Info($"{stopWatch.ElapsedMilliseconds} create form"); return(filledFormAttributes); } catch (ThreadAbortException) { logger.Error($"Thread aborted {stopWatch.ElapsedMilliseconds}"); } return(null); }
public FilledForm() { _name = null; _attributes = null; _master = null; _result = null; _alignment = null; }
private void DeletePageFromMasterForm(int pagenumber, FormRecognitionAttributes form) { FormRecognitionEngine recognitionEngine = SetupRecognitionEngine(); recognitionEngine.OpenMasterForm(form); recognitionEngine.DeleteMasterFormPage(form, pagenumber); recognitionEngine.CloseMasterForm(form); }
internal DiskMasterFormExample(IMasterFormsRepository repository, string name, string path, IMasterFormsCategory parent) { _repository = repository; _processingEngine = new FormProcessingEngine(); _attributes = null; _name = name; _parent = parent; _path = path; }
public MasterForm(string name) { _image = null; _attributes = new FormRecognitionAttributes(); _properties = new FormRecognitionProperties(); _properties.Name = name; _processingPages = null; _isDirty = false; }
public FormRecognitionAttributes CreateMasterForm(string name) { FormRecognitionOptions options = new FormRecognitionOptions(); FormRecognitionEngine recognitionEngine = SetupRecognitionEngine(); FormRecognitionAttributes attributes = recognitionEngine.CreateMasterForm(name, new Guid(), options); recognitionEngine.CloseMasterForm(attributes); return(attributes); }
// Update the attributes of this master form public void WriteAttributes(FormRecognitionAttributes attributes) { if (attributes == null) { throw new ArgumentNullException("attributes"); } _attributes = null; byte[] data = attributes.GetData(); File.WriteAllBytes(_path + ".bin", data); }
private PageRecognitionOptions GetPageOptions(int pageIndex, FormRecognitionAttributes attributes) { PageRecognitionOptions options = null; recognitionEngine.OpenMasterForm(attributes); options = recognitionEngine.GetPageOptions(attributes, pageIndex); recognitionEngine.CloseMasterForm(attributes); return(options); }
public MasterForm(string name, RasterImage image, FormRecognitionAttributes attr, FormRecognitionEngine engine) { _image = image; _attributes = attr; attr.Image = Image; _properties = engine.GetFormProperties(attr); _properties.Name = name; _processingPages = null; _isDirty = false; }
public FormRecognitionAttributes CreateForm(FormsRecognitionMethod method) { FormRecognitionOptions options = new FormRecognitionOptions(); options.RecognitionMethod = method; FormRecognitionAttributes attributes = RecognitionEngine.CreateForm(options); RecognitionEngine.CloseForm(attributes); return(attributes); }
// Get the attributes of this master form (from attributes you can get last access date/time/etc) public FormRecognitionAttributes ReadAttributes() { if (_attributes == null) { if (!File.Exists(_path + ".bin")) { return(null); } byte[] data = File.ReadAllBytes(_path + ".bin"); _attributes = new FormRecognitionAttributes(); _attributes.SetData(data); } return(_attributes); }
public void AddPageToMasterForm(RasterImage image, FormRecognitionAttributes attributes, int pageIndex, PageRecognitionOptions pageOptions) { try { FormRecognitionEngine recognitionEngine = SetupRecognitionEngine(); recognitionEngine.OpenMasterForm(attributes); recognitionEngine.InsertMasterFormPage(pageIndex, attributes, image, pageOptions, null); recognitionEngine.CloseMasterForm(attributes); } catch (Exception ex) { throw; } }
/// <summary> /// OcrMaster load master forms and start engines /// </summary> public OcrMaster() { string[] masterFormFields = Directory.GetFiles(BaseFolder, "*_Blocks_*.xml", SearchOption.AllDirectories); if (!StartUpEngines()) { throw new Exception("Could not start engines"); } foreach (string masterFormField in masterFormFields) { if (masterFormField.Contains("_runtime.")) { continue; } string binFile = String.Concat(Path.GetFileNameWithoutExtension(masterFormField), ".bin"); RasterImage tifImage = null; if (!File.Exists(binFile)) { string imageName = String.Concat(Path.GetFileNameWithoutExtension(masterFormField), ".tif"); string imagefullPath = Path.Combine(Path.GetDirectoryName(masterFormField), imageName); tifImage = RasterCodecs.Load(imagefullPath, 0, CodecsLoadByteOrder.BgrOrGray, 1, -1); // RasterCodecs.Load(imagefullPath, 0, CodecsLoadByteOrder.BgrOrGrayOrRomm, 1, -1); FormRecognitionAttributes masterFormAttributes2 = RecognitionEngine.CreateMasterForm(masterFormField, Guid.Empty, null); for (int i = 0; i < tifImage.PageCount; i++) { tifImage.Page = i + 1; //Add the master form page to the recognition engine RecognitionEngine.AddMasterFormPage(masterFormAttributes2, tifImage, null); } //Close the master form and save it's attributes RecognitionEngine.CloseMasterForm(masterFormAttributes2); //Load the master form image File.WriteAllBytes(binFile, masterFormAttributes2.GetData()); //binFiles.Add(binFile); } logger.Info($"Loading master form {masterFormField}"); var currentMasterForm = LoadMasterForm(binFile, masterFormField); var formList = BlockMasterForms; //if (fieldsfName.Contains("Block")) formList = BlockMasterForms; formList.Add(currentMasterForm); } }
public IMasterForm AddMasterForm(FormRecognitionAttributes attributes, FormPages fields, Uri url) { if (attributes == null) { throw new ArgumentException(string.Format("Master Form attributes should be available"), "attributes"); } // Create the file(s) FormRecognitionProperties properties = _recognitionEngine.GetFormProperties(attributes); DiskMasterFormExample masterForm = new DiskMasterFormExample(_repository, properties.Name, System.IO.Path.Combine(_path, properties.Name), this); // Create the file masterForm.WriteAttributes(attributes); if (fields != null) { masterForm.WriteFields(fields); } if (url != null) { masterForm.WriteForm(_repository.RasterCodecsInstance.Load(url, 1, CodecsLoadByteOrder.Bgr, 1, -1)); } _masterForms.AddMasterForm(masterForm); return(masterForm); }
public void AddPageToForm(RasterImage image, FormRecognitionAttributes attributes, PageRecognitionOptions options) { RecognitionEngine.OpenForm(attributes); RecognitionEngine.AddFormPage(attributes, image, options); RecognitionEngine.CloseForm(attributes); }
private void AddMasterFormPages(RasterImage imagesToAdd, DiskMasterForm currentform, string folderName) { try { DiskMasterForm currentMasterForm = currentform; FormRecognitionAttributes attributes = currentMasterForm.ReadAttributes(); FormPages formPages = currentMasterForm.ReadFields(); RasterImage formImage = currentMasterForm.ReadForm(); for (int i = 0; i < imagesToAdd.PageCount; i++) { //Add each new page to the masterform by creating attributes for each page imagesToAdd.Page = i + 1; AddPageToMasterForm(imagesToAdd.Clone(), attributes, -1, null); } //Add image if (formImage != null) { formImage.AddPages(imagesToAdd.CloneAll(), 1, imagesToAdd.PageCount); } else { formImage = imagesToAdd.CloneAll(); } //Only add processing pages for the new pages if (formPages != null) { for (int i = 0; i < imagesToAdd.PageCount; i++) { formPages.Add(new FormPage(formPages.Count + 1, imagesToAdd.XResolution, imagesToAdd.YResolution)); } } else { //No processing pages exist so we must create them FormRecognitionEngine recognitionEngine = SetupRecognitionEngine(); FormProcessingEngine tempProcessingEngine = new FormProcessingEngine(); tempProcessingEngine.OcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false); //tempProcessingEngine.BarcodeEngine = barcodeEngine; for (int i = 0; i < recognitionEngine.GetFormProperties(attributes).Pages; i++) { tempProcessingEngine.Pages.Add(new FormPage(i + 1, imagesToAdd.XResolution, imagesToAdd.YResolution)); } formPages = tempProcessingEngine.Pages; } //FormField newField = null; //AnnHiliteObject newObject = new AnnHiliteObject(); //newField = new TextFormField(); //newField.Name = "test"; //newField.Bounds = new LogicalRectangle(50, 50, 50, 50, LogicalUnit.Pixel); //FormField newField1 = null; //AnnHiliteObject newObject1 = new AnnHiliteObject(); //newField1 = new OmrFormField(); //newField1.Name = "test1"; //newField1.Bounds = new LogicalRectangle(50, 50, 50, 50, LogicalUnit.Pixel); //newObject.Tag = newField; //newObject1.Tag = newField1; //FormField currentField = newObject.Tag as FormField; //FormField currentField1 = newObject1.Tag as FormField; //formPages[0].Add(currentField); //formPages[0].Add(currentField1); currentMasterForm.WriteForm(formImage); currentMasterForm.WriteAttributes(attributes); currentMasterForm.WriteFields(formPages); DBHelper.UpdateTifPageCount(formImage.PageCount.ToString(), folderName); } catch (Exception ex) { throw; } }
public static void TestOcr2() { string BaseFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); try { string[] masterFileNames = Directory.GetFiles(BaseFolder, "2*.tif", SearchOption.AllDirectories); //Get master form filenames //You may need to update the below path to point to the "Leadtools Images\Forms\MasterForm Sets\OCR" directory. FormRecognitionEngine recognitionEngine = new FormRecognitionEngine(); RasterCodecs codecs; //Create the OCR Engine to use in the recognition IOcrEngine formsOCREngine; codecs = new RasterCodecs(); //Create a LEADTOOLS OCR Module - LEAD Engine and start it formsOCREngine = OcrEngineManager.CreateEngine(OcrEngineType.OmniPage, false); //formsOCREngine.Startup(codecs, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime"); formsOCREngine.Startup(codecs, null, null, null); //Add an OCRObjectManager to the recognition engines //ObjectManager collection OcrObjectsManager ocrObjectsManager = new OcrObjectsManager(formsOCREngine); ocrObjectsManager.Engine = formsOCREngine; recognitionEngine.ObjectsManagers.Add(ocrObjectsManager); var binFiles = new List <string>(); foreach (string masterFileName in masterFileNames) { string formName = Path.GetFileNameWithoutExtension(masterFileName); //Load the master form image RasterImage image = codecs.Load(masterFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, -1); //Create a new master form FormRecognitionAttributes masterFormAttributes = recognitionEngine.CreateMasterForm(formName, Guid.Empty, null); for (int i = 0; i < image.PageCount; i++) { image.Page = i + 1; //Add the master form page to the recognition engine recognitionEngine.AddMasterFormPage(masterFormAttributes, image, null); } //Close the master form and save it's attributes recognitionEngine.CloseMasterForm(masterFormAttributes); var binFile = formName + "_runtime.bin"; File.WriteAllBytes(binFile, masterFormAttributes.GetData()); binFiles.Add(binFile); } logger.Info("Master Form Processing Complete {0}", "Complete"); //For this tutorial, we will use the sample W9 filled form. //You may need to update the below path to point to "\LEADTOOLS Images\Forms\Forms to be Recognized\OCR\W9_OCR_Filled.tif". if (true) { string formToRecognize = Path.Combine(BaseFolder, "13984799_02.png"); RasterImage image = codecs.Load(formToRecognize, 0, CodecsLoadByteOrder.BgrOrGray, 1, -1); //Load the image to recognize FormRecognitionAttributes filledFormAttributes = recognitionEngine.CreateForm(null); for (int i = 0; i < image.PageCount; i++) { image.Page = i + 1; //Add each page of the filled form to the recognition engine recognitionEngine.AddFormPage(filledFormAttributes, image, null); } recognitionEngine.CloseForm(filledFormAttributes); string resultMessage = "The form could not be recognized"; //Compare the attributes of each master form to the attributes of the filled form foreach (string masterFileName in binFiles) { FormRecognitionAttributes masterFormAttributes = new FormRecognitionAttributes(); masterFormAttributes.SetData(File.ReadAllBytes(masterFileName)); FormRecognitionResult recognitionResult = recognitionEngine.CompareForm(masterFormAttributes, filledFormAttributes, null); //In this example, we consider a confidence equal to or greater //than 90 to be a match if (recognitionResult.Confidence >= 90) { resultMessage = String.Format("This form has been recognized as a {0}", Path.GetFileNameWithoutExtension(masterFileName)); break; } } logger.Info(resultMessage, "Recognition Results"); } } catch (Exception ex) { logger.Info(ex.Message); throw; } }
private void UpdateData() { var recognitionEngineVersion = FormRecognitionEngine.Version; #if FOR_DOTNET4 var originalFullTextSearchManager = recognitionEngine.FullTextSearchManager; #endif try { if (!Directory.Exists(_txtSrcFolder.Text)) { Invoke((MethodInvoker) delegate { Messager.Show(this, "Please select valid folder", MessageBoxIcon.Error, MessageBoxButtons.OK); }); return; } // Set the data version to latest, we want to update the data to use the latest FormRecognitionEngine.Version = FormRecognitionEngine.LatestVersion; // Set the full text search engine DiskMasterFormsRepository workingRepository = new DiskMasterFormsRepository(_codecs, _txtSrcFolder.Text); #if FOR_DOTNET4 if (_cbUseFullTextSearch.Checked) { DiskFullTextSearchManager fullTextSearchManager = new DiskFullTextSearchManager(); fullTextSearchManager.IndexDirectory = Path.Combine(workingRepository.Path, "index"); recognitionEngine.FullTextSearchManager = fullTextSearchManager; } #endif IMasterFormsCategory parentCategory = workingRepository.RootCategory; Invoke((MethodInvoker) delegate { _prgbar.Maximum = parentCategory.MasterForms.Count; }); for (int i = 0; i < _prgbar.Maximum; i++) { if (!_isRunning) { return; } Invoke((MethodInvoker) delegate { _prgbar.Value++; }); //Get the Original Attributes DiskMasterForm originalMasterForm = parentCategory.MasterForms[i] as DiskMasterForm; FormRecognitionAttributes originalAttributes = originalMasterForm.ReadAttributes(); recognitionEngine.OpenMasterForm(originalAttributes); recognitionEngine.CloseMasterForm(originalAttributes); FormRecognitionOptions options = new FormRecognitionOptions(); FormRecognitionAttributes attributes = recognitionEngine.CreateMasterForm(parentCategory.MasterForms[i].Name, new Guid(), options); recognitionEngine.CloseMasterForm(attributes); IMasterForm newForm = parentCategory.AddMasterForm(attributes, null, (RasterImage)null); DiskMasterForm currentMasterForm = parentCategory.MasterForms[i] as DiskMasterForm; attributes = currentMasterForm.ReadAttributes(); FormPages formPages = currentMasterForm.ReadFields(); RasterImage formImage = currentMasterForm.ReadForm(); for (int j = 0; j < formImage.PageCount; j++) { //Get the Page Recognition Options for the original Attributes PageRecognitionOptions pageOptions = GetPageOptions(j, originalAttributes); //Add each new page to the masterform by creating attributes for each page formImage.Page = j + 1; recognitionEngine.OpenMasterForm(attributes); recognitionEngine.DeleteMasterFormPage(attributes, j + 1); recognitionEngine.InsertMasterFormPage(j + 1, attributes, formImage.Clone(), pageOptions, null); #if FOR_DOTNET4 if (_cbUseFullTextSearch.Checked) { recognitionEngine.UpsertMasterFormToFullTextSearch(attributes, "index", null, null, null, null); } #endif recognitionEngine.CloseMasterForm(attributes); } FormProcessingEngine tempProcessingEngine = new FormProcessingEngine(); tempProcessingEngine.OcrEngine = ocrEngine; tempProcessingEngine.BarcodeEngine = barcodeEngine; for (int j = 0; j < recognitionEngine.GetFormProperties(attributes).Pages; j++) { tempProcessingEngine.Pages.Add(new FormPage(j + 1, formImage.XResolution, formImage.YResolution)); } formPages = tempProcessingEngine.Pages; currentMasterForm.WriteAttributes(attributes); currentMasterForm.WriteFields(parentCategory.MasterForms[i].ReadFields()); } #if FOR_DOTNET4 if (recognitionEngine.FullTextSearchManager != null) { recognitionEngine.FullTextSearchManager.Index(); } #endif System.Diagnostics.Process.Start(_txtSrcFolder.Text); } catch (Exception ex) { Invoke((MethodInvoker) delegate { Messager.Show(this, ex, MessageBoxIcon.Error); }); } finally { // Restore the original version FormRecognitionEngine.Version = recognitionEngineVersion; #if FOR_DOTNET4 recognitionEngine.FullTextSearchManager = originalFullTextSearchManager; #endif _isRunning = false; Invoke((MethodInvoker) delegate { _prgbar.Value = 0; UpdateControls(); }); } }
public HttpResponseMessage DeletePage(FormDataCollection Form) { HttpResponseMessage httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK, "Some problem in delete master form page."); if (Form != null) { string PageNumber = Form["PageNumber"]?.ToString().Trim() ?? ""; string FolderName = Form["FolderName"]?.ToString().Trim() ?? ""; string result = DBHelper.GetFileFriendlyName(FolderName); string workingDirectory = HttpContext.Current.Server.MapPath("~/" + RootFolderName + "/" + result); if (Directory.Exists(workingDirectory)) { using (RasterCodecs _codecs = new RasterCodecs()) { RasterDefaults.DitheringMethod = RasterDitheringMethod.None; ServiceHelper.SetLicense(); workingRepository = new DiskMasterFormsRepository(_codecs, workingDirectory); var masterForm = workingRepository?.RootCategory?.MasterForms?.FirstOrDefault(); if (masterForm != null) { DiskMasterForm currentMasterForm = (DiskMasterForm)masterForm; FormRecognitionAttributes attributes = currentMasterForm.ReadAttributes(); int currentPageIdx = Convert.ToInt32(PageNumber); FormPages formPages = currentMasterForm.ReadFields(); RasterImage formImage = currentMasterForm.ReadForm(); //Delete page from master form attaributes DeletePageFromMasterForm(currentPageIdx + 1, attributes); //page number here is 1 based //Delete fields page formPages.RemoveAt(currentPageIdx); //Delete the page from the image if (formImage.PageCount == 1) { formImage = null; //You cannot remove the only page from a rasterimage, an exception will occur } else { formImage.RemovePageAt(currentPageIdx + 1); } //We need to recreate the FormPages to ensure the page numbers are updated correctly for (int i = 0; i < formPages.Count; i++) { FormPage currentPage = formPages[i]; FormPage newPage = new FormPage(i + 1, currentPage.DpiX, currentPage.DpiY); newPage.AddRange(currentPage.GetRange(0, currentPage.Count)); formPages[i] = newPage; } //Write the updated masterform to disk. Delete it first just in case the entire image was deleted DiskMasterFormsCategory parentCategory = (workingRepository.RootCategory) as DiskMasterFormsCategory; parentCategory.DeleteMasterForm(currentMasterForm); parentCategory.AddMasterForm(attributes, formPages, formImage); httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK, "Page deleted from master set sucessfully."); DBHelper.UpdateTifPageCount(formPages.Count.ToString(), FolderName); } } } } return(httpResponseMessage); }
private bool AddField(DiskMasterForm currentform, List <XmlModel> model) { try { DiskMasterForm currentMasterForm = currentform; FormRecognitionAttributes attributes = currentMasterForm.ReadAttributes(); FormPages formPages = currentMasterForm.ReadFields(); RasterImage formImage = currentMasterForm.ReadForm(); foreach (XmlModel xmlModel in model) { int i = formPages[xmlModel.PageNumber - 1].Count; formPages[xmlModel.PageNumber - 1].RemoveRange(0, i); foreach (XmlDetail xmlDetail in xmlModel.Detail) { FormField newField = null; if (xmlDetail.FieldInfo.ObjectId == -51) // For textfield => -51 //for OmrField => -50 { newField = new TextFormField(); (newField as TextFormField).EnableIcr = xmlDetail.FieldInfo.OcrFieldInfo.EnableICR; (newField as TextFormField).EnableOcr = xmlDetail.FieldInfo.OcrFieldInfo.EnableOCR; (newField as TextFormField).Type = (xmlDetail.FieldInfo.OcrFieldInfo.Character == true ? TextFieldType.Character : (xmlDetail.FieldInfo.OcrFieldInfo.Numeric == true ? TextFieldType.Numerical : TextFieldType.Data)); if (xmlDetail.FieldInfo.OcrFieldInfo.CellBoarders) { newField.Dropout |= DropoutFlag.CellsDropout; } else { newField.Dropout &= ~DropoutFlag.CellsDropout; } if (xmlDetail.FieldInfo.OcrFieldInfo.Words) { newField.Dropout |= DropoutFlag.WordsDropout; } else { newField.Dropout &= ~DropoutFlag.WordsDropout; } } else { newField = new OmrFormField(); if (xmlDetail.FieldInfo.OmrFieldInfo.WithFrame) { (newField as OmrFormField).FrameMethod = OcrOmrFrameDetectionMethod.WithFrame; } else if (xmlDetail.FieldInfo.OmrFieldInfo.WithoutFrame) { (newField as OmrFormField).FrameMethod = OcrOmrFrameDetectionMethod.WithoutFrame; } else if (xmlDetail.FieldInfo.OmrFieldInfo.Auto) { (newField as OmrFormField).FrameMethod = OcrOmrFrameDetectionMethod.Auto; } if (xmlDetail.FieldInfo.OmrFieldInfo.Lowest) { (newField as OmrFormField).Sensitivity = OcrOmrSensitivity.Lowest; } else if (xmlDetail.FieldInfo.OmrFieldInfo.Low) { (newField as OmrFormField).Sensitivity = OcrOmrSensitivity.Low; } else if (xmlDetail.FieldInfo.OmrFieldInfo.High) { (newField as OmrFormField).Sensitivity = OcrOmrSensitivity.High; } else if (xmlDetail.FieldInfo.OmrFieldInfo.Highest) { (newField as OmrFormField).Sensitivity = OcrOmrSensitivity.Highest; } } newField.Name = xmlDetail.FieldInfo.Name; newField.Bounds = new LeadRect(Convert.ToInt32(Annotations.Engine.AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.X, Leadtools.Annotations.Engine.AnnUnit.Unit, 96)), Convert.ToInt32(Annotations.Engine.AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Y, Annotations.Engine.AnnUnit.Unit, 96)), Convert.ToInt32(Annotations.Engine.AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Width, Annotations.Engine.AnnUnit.Unit, 96)), Convert.ToInt32(Annotations.Engine.AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Height, Annotations.Engine.AnnUnit.Unit, 96))); // newField.Bounds= new LogicalRectangle(AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.X, AnnUnit.Unit, 96), AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Y, AnnUnit.Unit, 96), AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Width, AnnUnit.Unit, 96), AnnUnitConverter.ConvertToPixels(xmlDetail.Cordinates.Height, AnnUnit.Unit, 96), LogicalUnit.Pixel); Annotations.Engine.AnnHiliteObject newObject = new Annotations.Engine.AnnHiliteObject(); newObject.Tag = newField; FormField currentField = newObject.Tag as FormField; formPages[xmlModel.PageNumber - 1].Add(currentField); } } currentMasterForm.WriteForm(formImage); currentMasterForm.WriteAttributes(attributes); currentMasterForm.WriteFields(formPages); return(true); } catch (Exception ex) { return(false); throw; } }