alexa
menu

Document Processing

    Show / Hide Table of Contents

    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
    System.Object
    FormRecognizer
    Implements
    IFormRecognizer
    Namespace: Syncfusion.SmartFormRecognizer
    Assembly: Syncfusion.SmartFormRecognizer.Base.dll
    Syntax
    public class FormRecognizer : Object, IFormRecognizer

    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.

    RecognizeFormAsJson(Stream, Dictionary<Int32, List<RectangleF>>, Boolean, Boolean, Boolean, Boolean, Double, Int32[,])

    Recognizes the form in pdfStream (PDF or image) and returns the recognition result serialized as a JSON string.

    Declaration
    public string RecognizeFormAsJson(Stream pdfStream, Dictionary<int, List<RectangleF>> existingFormFieldBounds, bool detectTextboxes, bool detectCheckboxes, bool detectRadioButtons, bool detectSignatures, double confidenceThreshold, int[, ] pageRange)
    Parameters
    Type Name Description
    System.IO.Stream pdfStream

    Input stream containing the PDF or image document to analyze.

    System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.List<System.Drawing.RectangleF>> existingFormFieldBounds

    Optional existing form field bounds to exclude from detection.

    System.Boolean detectTextboxes

    Detect textbox form fields. High priority over FormRecognizeOptions.

    System.Boolean detectCheckboxes

    Detect checkbox form fields. High priority over FormRecognizeOptions.

    System.Boolean detectRadioButtons

    Detect radio button form fields. High priority over FormRecognizeOptions.

    System.Boolean detectSignatures

    Detect signature form fields. High priority over FormRecognizeOptions.

    System.Double confidenceThreshold

    Confidence threshold for detection. High priority over FormRecognizeOptions.

    System.Int32[,] pageRange

    Page range to process. High priority over FormRecognizeOptions.

    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.

    Implements

    IFormRecognizer
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved