←Select platform

DeleteFormPage Method

Summary
Deletes the specified page from the specified Form attribute object.

Syntax
C#
C++/CLI
Java
Python
public void DeleteFormPage( 
   FormRecognitionAttributes attributes, 
   int pageNumber 
) 
public void deleteFormPage( 
   FormRecognitionAttributes attributes, 
   int pageNumber 
); 
public: 
void DeleteFormPage(  
   FormRecognitionAttributes^ attributes, 
   int pageNumber 
)  
def DeleteFormPage(self,attributes,pageNumber): 

Parameters

attributes
The Form attribute object.

pageNumber
The page being deleted from the form. The page number is a 1-based index.

Remarks

The object should be a Form attribute object. To delete a page from a Master Form attribute object, call the DeleteMasterFormPagemethod.

Example

This example deletes a page from the Form

C#
Java
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Forms.Processing; 
using Leadtools.Forms.Recognition; 
using Leadtools.Forms.Recognition.Barcode; 
using Leadtools.Forms.Recognition.Ocr; 
 
/// This method deletes a page from form attributes for recognition. 
public void DeletePageFromForm(FormRecognitionEngine recognitionEngine, 
                               int pagenumber, 
                               FormRecognitionAttributes form) 
{ 
   recognitionEngine.OpenForm(form); 
   recognitionEngine.DeleteFormPage(form, pagenumber); 
   recognitionEngine.CloseForm(form); 
} 
 
import java.util.*; 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.forms.common.PageAlignment; 
import leadtools.forms.processing.FormPages; 
import leadtools.forms.recognition.*; 
 
 
class MasterForm { 
   public RasterImage image; 
   public FormRecognitionAttributes attributes; 
   public FormRecognitionProperties properties; 
   public FormPages processingPages; 
 
   public MasterForm() { 
      image = null; 
      attributes = null; 
      properties = FormRecognitionProperties.getEmpty(); 
      processingPages = null; 
   } 
} 
 
class MyForm { 
   public String fileName; 
   public RasterImage image; 
   public FormRecognitionAttributes attributes; 
   public MasterForm master; 
   public FormRecognitionResult result; 
   public List<PageAlignment> alignment; 
   public FormPages processingPages; 
 
   public MyForm() { 
      fileName = null; 
      image = null; 
      attributes = null; 
      master = null; 
      result = null; 
      alignment = null; 
   } 
} 
 
FormRecognitionEngine recognitionEngine = new FormRecognitionEngine(); 
RasterCodecs codecs = new RasterCodecs(); 
 
public void deletePageFromFormExample() { 
   MyForm form = new MyForm(); 
   form.fileName = "C:\\LEADTOOLS23\\Resources\\Images\\Forms\\Forms to be Recognized\\OCR\\FCC-107_OCR_Filled.tif"; 
   form.image = loadRecognitionImageFile(form.fileName); 
 
   createFormForRecognition(form); 
   addPageToForm(loadImageFile(form.fileName, 1, 2), form.attributes); 
 
   deletePageFromForm(1, form.attributes); 
   assertTrue("Incorrect # of pages", form.image.getPageCount() == 1); 
} 
 
public RasterImage loadRecognitionImageFile(String fileName) { 
   RasterImage image; 
   image = loadImageFile(fileName, 1, 1); 
   return image; 
} 
 
public RasterImage loadImageFile(String fileName, int firstPage, int lastPage) { 
   RasterImage image = codecs.load(fileName, 1, CodecsLoadByteOrder.BGR, firstPage, lastPage); 
   return image; 
} 
 
public void createFormForRecognition(MyForm form) { 
   form.attributes = createForm(); 
   int saveCurrentPageIndex = form.image.getPage(); 
   for (int i = 0; i < form.image.getPageCount(); i++) { 
      form.image.setPage(i + 1); 
      addPageToForm(form.image, form.attributes); 
   } 
   form.image.setPage(saveCurrentPageIndex); 
} 
 
public FormRecognitionAttributes createForm() { 
   FormRecognitionAttributes attributes = recognitionEngine.createForm(null); 
   recognitionEngine.closeForm(attributes); 
   return attributes; 
} 
 
public void addPageToForm(RasterImage image, FormRecognitionAttributes attributes) { 
   recognitionEngine.openForm(attributes); 
   recognitionEngine.addFormPage(attributes, image, null); 
   recognitionEngine.closeForm(attributes); 
} 
 
public void deletePageFromForm(int pageNumber, FormRecognitionAttributes form) { 
   recognitionEngine.openForm(form); 
   recognitionEngine.deleteFormPage(form, pageNumber); 
   recognitionEngine.closeForm(form); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Recognition Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.