GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / ADRGetTemplateID Method
Template index. Value between 1 and ADRGetTemplateCount().
Example





In This Topic
ADRGetTemplateID Method (GdPictureImaging)
In This Topic
Returns a Document Identifier Template ID from his index.
Syntax
'Declaration
 
Public Function ADRGetTemplateID( _
   ByVal TemplateNo As Integer _
) As Integer
public int ADRGetTemplateID( 
   int TemplateNo
)
public function ADRGetTemplateID( 
    TemplateNo: Integer
): Integer; 
public function ADRGetTemplateID( 
   TemplateNo : int
) : int;
public: int ADRGetTemplateID( 
   int TemplateNo
) 
public:
int ADRGetTemplateID( 
   int TemplateNo
) 

Parameters

TemplateNo
Template index. Value between 1 and ADRGetTemplateCount().

Return Value

The Template ID. If TemplateNo is invalid, returns -1.
Example
Creating two templates and renaming a file using the name of the template which has the best similar content.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Create a template "A".
    int templateID = gdpictureImaging.ADRCreateTemplateFromFile(@"templateA.tif");
    gdpictureImaging.ADRSetTemplateTag(templateID, "TemplateA");
 
    // Create a template "B".
    templateID = gdpictureImaging.ADRCreateTemplateFromFile(@"templateB.tif");
    gdpictureImaging.ADRSetTemplateTag(templateID, "TemplateB");
 
    // Identify the template which has the best similar content and change the file name accordingly.
    templateID = gdpictureImaging.ADRGetCloserTemplateForFile("image.tif");
    string templateName = gdpictureImaging.ADRGetTemplateTag(templateID);
    File.Move("image.tif", templateName + "_image.tif");
 
    // Deletes all document identifier templates.
    int templateCount = gdpictureImaging.ADRGetTemplateCount();
    for (int i = 1; i <= templateCount; i++)
    {
        templateID = gdpictureImaging.ADRGetTemplateID(1);
        gdpictureImaging.ADRDeleteTemplate(templateID);
    }
}
See Also