com.groupdocs.parser.templates

Class TemplateLinkedPosition



  • public class TemplateLinkedPosition
    extends TemplatePosition
    Provides a template field position which uses the linked field.

    The following example shows the code for the situation if it's known that the field with an invoice number is placed on the right of "Invoice number" string the following code is used:

    // Create a regex template field to find "Invoice Number" text
     TemplateField invoice = new TemplateField(new TemplateRegexPosition("Invoice Number"), "Invoice");
    
     // Create a related template field associated with "Invoice" field and extract the value on the right of it
     TemplateField invoiceNumber = new TemplateField(
         new TemplateLinkedPosition("invoice", new Size(100, 15), new TemplateLinkedPositionEdges(false, false, true, false)),
         "InvoiceNumber");
     
    • Constructor Detail

      • TemplateLinkedPosition

        public TemplateLinkedPosition(String linkedFieldName,
                              Size searchArea,
                              TemplateLinkedPositionEdges edges)
        Initializes a new instance of the TemplateLinkedPosition class.
        Parameters:
        linkedFieldName - The name of the linked field.
        searchArea - The size of the area where a field is searched.
        edges - The edges of the linked field where a field is searched.
      • TemplateLinkedPosition

        public TemplateLinkedPosition(String linkedFieldName,
                              Size searchArea,
                              TemplateLinkedPositionEdges edges,
                              boolean autoScale)
        Initializes a new instance of the TemplateLinkedPosition class.
        Parameters:
        linkedFieldName - The name of the linked field.
        searchArea - The size of the area where a field is searched.
        edges - The edges of the linked field where a field is searched.
        autoScale - The value that indicates whether searchArea is scaled by the linked field size.
    • Method Detail

      • getLinkedFieldName

        public String getLinkedFieldName()
        Gets the linked field name.
        Returns:
        An uppercase string value that represents the linked field name.
      • getSearchArea

        public Size getSearchArea()
        Gets the size of the area where a field is searched.
        Returns:
        An instance of Size class that represents the size of the area where a field is searched.
      • isAutoScale

        public Boolean isAutoScale()
        Gets the value that indicates whether SearchArea is scaled by the linked field size.
        Returns:
        {code true} if SearchArea is scaled by the linked field size; otherwise, false.