←Select platform

GetData Method

Summary
Gets the array of bytes containing the encoded attributes.

Syntax
C#
C++/CLI
Java
Python
public byte[] GetData() 
public byte[] getData(); 
public void setData( 
   byte[] 
); 
public: 
array<byte>^ GetData();  
def GetData(self): 
Remarks

Forms attributes that are generated by FormRecognitionEngine.CreateMasterForm for Master Forms or FormRecognitionEngine.CreateForm for Forms will have the form's attributes that are specified in FormRecognitionEngine.ObjectsManagers. To start modifying the form's attributes you have to open it using OpenMasterForm for Master Forms or OpenForm for Forms, or create it using FormRecognitionEngine.CreateMasterForm for Master Forms or FormRecognitionEngine.CreateForm for Forms.

Forms attributes data will be updated with the changes you made to the form attributes such as addition of a page or deletion of a page once the attributes is closed using either FormRecognitionEngine.CloseMasterForm for Master Form attributes or FormRecognitionEngine.CloseForm for Form attributes.

Once you finish modifying the form's attributes close it to reflect your changes.

GetData is useful to save attributes data specially for Master forms on the disk or database.

Example

This example saves form's attributes to a file.

C#
Java
using Leadtools.Forms.Common; 
using Leadtools.Forms.Recognition; 
using Leadtools.Codecs; 
 
/// This method saves master form attributes to the specified file name. 
public void SaveMasterFormAttributes(FormRecognitionAttributes attributes, string attributesFileName) 
{ 
   byte[] formData = attributes.GetData(); 
   File.WriteAllBytes(attributesFileName, formData); 
} 
 
import static org.junit.Assert.assertTrue; 
 
import java.io.File; 
import java.io.IOException; 
import java.io.RandomAccessFile; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import leadtools.forms.recognition.FormRecognitionAttributes; 
 
 
public void saveMasterFormAttributesExample() throws IOException { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String attributesFileName = combine(LEAD_VARS_IMAGES_DIR, "leadtools.pdf"); 
       
   byte[] formData = Files.readAllBytes(Paths.get(attributesFileName)); 
   RandomAccessFile file = new RandomAccessFile(attributesFileName, "rw"); 
   file.write(formData); 
   file.close(); 
 
   assertTrue("Attributes saved incorrectly", formData.length > 0); 
   System.out.println("Command run, attributes saved."); 
} 
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.