FormRecognizer Class
Provides methods to recognize forms from an input stream (PDF or image) and return results as a PDF document, PDF stream, or JSON string.
Inheritance
Namespace: Syncfusion.SmartFormRecognizer
Assembly: Syncfusion.SmartFormRecognizer.Base.dll
Syntax
public class FormRecognizer : Object
Constructors
FormRecognizer()
Initializes a new instance of the FormRecognizer class. No initialization arguments are required; configure the model path before calling detection methods if needed.
Declaration
public FormRecognizer()
Properties
FormRecognizeOptions
Options controlling recognition behavior. The instance is created during construction and returned by this property; callers may modify the instance's properties to change runtime behavior.
Declaration
public FormRecognizeOptions FormRecognizeOptions { get; set; }
Property Value
| Type |
|---|
| FormRecognizeOptions |
Methods
RecognizeFormAsJson(Stream)
Recognizes the form in pdfStream (PDF or image)
and returns the recognition result serialized as a JSON string.
Declaration
public string RecognizeFormAsJson(Stream pdfStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | pdfStream | Input stream containing the PDF or image document to analyze. |
Returns
| Type | Description |
|---|---|
| System.String | A JSON string describing the recognized form. |
RecognizeFormAsJsonAsync(Stream, CancellationToken)
Asynchronously recognizes the form in inputStream
and returns the recognition result as a JSON string.
Declaration
public Task<string> RecognizeFormAsJsonAsync(Stream inputStream, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | inputStream | Input stream containing the PDF or image document to analyze. |
| System.Threading.CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | A task that completes with a JSON string describing the recognized form. |
RecognizeFormAsPdfDocument(Stream)
Recognizes the form contained in inputStream (PDF or image)
and returns a PdfLoadedDocument representing the recognized PDF.
Declaration
public PdfLoadedDocument RecognizeFormAsPdfDocument(Stream inputStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | inputStream | Input stream containing the PDF or image document to analyze. |
Returns
| Type | Description |
|---|---|
| PdfLoadedDocument | A PdfLoadedDocument containing recognition results as a PDF. |
RecognizeFormAsPdfDocumentAsync(Stream, CancellationToken)
Asynchronously recognizes the form in inputStream (PDF or image)
and returns a PdfLoadedDocument.
Declaration
public Task<PdfLoadedDocument> RecognizeFormAsPdfDocumentAsync(Stream inputStream, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | inputStream | Input stream containing the PDF or image document to analyze. |
| System.Threading.CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<PdfLoadedDocument> | A task completing with a PdfLoadedDocument. |
RecognizeFormAsPdfStream(Stream)
Recognizes the form in pdfStream (PDF or image)
and returns the recognized PDF as a System.IO.Stream.
Declaration
public Stream RecognizeFormAsPdfStream(Stream pdfStream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | pdfStream | Input stream containing the PDF or image document to analyze. |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | A System.IO.Stream containing the recognized PDF data. |
RecognizeFormAsPdfStreamAsync(Stream, CancellationToken)
Asynchronously recognizes the form in inputStream
and returns the recognized PDF as a System.IO.Stream.
Declaration
public Task<Stream> RecognizeFormAsPdfStreamAsync(Stream inputStream, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | inputStream | Input stream containing the PDF or image document to analyze. |
| System.Threading.CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.IO.Stream> | A task that completes with a System.IO.Stream containing the recognized PDF data. |