SetTagTitle Method (GdPicturePDF)
                In This Topic
            
            Sets the title of the structure element (tag) specified by its unique (tag's) identifier, that is a part of the document's tag structure tree related to the currently loaded PDF document. 
It is a text string in the readable form representing the specific structure element (tag), for example, Section 1 or Volume 1, etc.
Syntax
            
        
            Parameters
- TagID
- A unique tag identifier of the tag's tree element
- Title
- The new title of the specified tag's tree element.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. 
We strongly recommend always checking this status first.
 
            
            
            
            
            
            Example
How to utilize a title property of a newly created tag element.
            
            
            
             
    
	
		Dim caption As String = "Example: SetTagTitle"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    Dim message As String = ""
    If (gdpicturePDF.NewPDF(PdfConformance.PDF_UA_1) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) Then
        gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
        'This is required to have a valid PDF_UA document.
        gdpicturePDF.SetTitle("My first PDF/UA document")
        Dim fontResName As String = gdpicturePDF.AddTrueTypeFontU("Arial", False, False, False)
        If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
            message = "Setting text properties has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        Dim tagRootID As Integer = gdpicturePDF.GetTagRootID()
        If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
            message = "The GetTagRootID() method has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Creating a parent tag of the type 'Div' that will hold both the form field and its caption.
        Dim divTag As Integer = gdpicturePDF.NewTag(tagRootID, "Div")
        If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
            message = "The NewTag(Div) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Creating a tag of the type 'Caption'.
        Dim captionTag As Integer = gdpicturePDF.NewTag(divTag, "Caption")
        If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
            message = "The NewTag(Caption) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Drawing a caption for the text form field.
        If (gdpicturePDF.BeginMarkedContentSequence(captionTag, "Span") <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.DrawText(fontResName, 100, 70, "Your toolkit is: ") <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.EndMarkedContent() <> GdPictureStatus.OK) Then
            message = "The creation of the marked content sequence has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Creating a tag of the type 'Form'.
        Dim formTag As Integer = gdpicturePDF.NewTag(divTag, "Form")
        If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
            message = "The NewTag(Form) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Creating a text form field.
        Dim formID As Integer = gdpicturePDF.AddTextFormField(220, 50, 150, 30, "TextField_Name", "GdPicture14", False, fontResName, 20, Color.Brown)
        If (gdpicturePDF.GetStat() <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.SetFormFieldBackgroundColor(formID, Color.White) <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.SetFormFieldBorderColor(formID, Color.Brown) <> GdPictureStatus.OK) Then
            message = "The NewTag(Caption) method has failed. status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        'Attaching the prepared tag to the new text form field.
        If (gdpicturePDF.AttachTagToFormField(formTag, formID) <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.SetTagTitle(formTag, "Name Field") <> GdPictureStatus.OK) OrElse
           (gdpicturePDF.SetFormFieldAlternateTitle(formID, "Name Field") <> GdPictureStatus.OK) Then
            message = "Attaching the tag to the form field has failed. Status: " + gdpicturePDF.GetStat().ToString()
            GoTo [error]
        End If
        If gdpicturePDF.SaveToFile("test_tagged.pdf") = GdPictureStatus.OK Then
            message = "Your tagged document has been successfully created."
        Else
            message = "The example has been successfully followed, but the SaveToFile() method has failed. Status: " + gdpicturePDF.GetStat().ToString()
        End If
[error]:
        MessageBox.Show(message, caption)
        gdpicturePDF.CloseDocument()
    Else
        MessageBox.Show("The new document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
End Using
	 
	
		string caption = "Example: SetTagTitle";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    string message = "";
    if ((gdpicturePDF.NewPDF(PdfConformance.PDF_UA_1) == GdPictureStatus.OK) &&
        (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK))
    {
        gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
        //This is required to have a valid PDF_UA document.
        gdpicturePDF.SetTitle("My first PDF/UA document");
        string fontResName = gdpicturePDF.AddTrueTypeFontU("Arial", false, false, false);
        if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
        {
            message = "Setting text properties has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        int tagRootID = gdpicturePDF.GetTagRootID();
        if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
        {
            message = "The GetTagRootID() method has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Creating a parent tag of the type 'Div' that will hold both the form field and its caption.
        int divTag = gdpicturePDF.NewTag(tagRootID, "Div");
        if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
        {
            message = "The NewTag(Div) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Creating a tag of the type 'Caption'.
        int captionTag = gdpicturePDF.NewTag(divTag, "Caption");
        if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
        {
            message = "The NewTag(Caption) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Drawing a caption for the text form field.
        if ((gdpicturePDF.BeginMarkedContentSequence(captionTag, "Span") != GdPictureStatus.OK) ||
            (gdpicturePDF.DrawText(fontResName, 100, 70, "Your toolkit is: ") != GdPictureStatus.OK) ||
            (gdpicturePDF.EndMarkedContent() != GdPictureStatus.OK))
        {
            message = "The creation of the marked content sequence has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Creating a tag of the type 'Form'.
        int formTag = gdpicturePDF.NewTag(divTag, "Form");
        if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
        {
            message = "The NewTag(Form) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Creating a text form field.
        int formID = gdpicturePDF.AddTextFormField(220, 50, 150, 30, "TextField_Name", "GdPicture14", false, fontResName, 20, Color.Brown);
        if ((gdpicturePDF.GetStat() != GdPictureStatus.OK) ||
            (gdpicturePDF.SetFormFieldBackgroundColor(formID, Color.White) != GdPictureStatus.OK) ||
            (gdpicturePDF.SetFormFieldBorderColor(formID, Color.Brown) != GdPictureStatus.OK))
        {
            message = "The NewTag(Caption) method has failed. status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        //Attaching the prepared tag to the new text form field.
        if ((gdpicturePDF.AttachTagToFormField(formTag, formID) != GdPictureStatus.OK) ||
            (gdpicturePDF.SetTagTitle(formTag, "Name Field") != GdPictureStatus.OK) ||
            (gdpicturePDF.SetFormFieldAlternateTitle(formID, "Name Field") != GdPictureStatus.OK))
        {
            message = "Attaching the tag to the form field has failed. Status: " + gdpicturePDF.GetStat().ToString();
            goto error;
        }
        if (gdpicturePDF.SaveToFile("test_tagged.pdf") == GdPictureStatus.OK)
            message = "Your tagged document has been successfully created.";
        else
            message = "The example has been successfully followed, but the SaveToFile() method has failed. Status: " + gdpicturePDF.GetStat().ToString();
        error:
        MessageBox.Show(message, caption);
        gdpicturePDF.CloseDocument();
    }
    else
        MessageBox.Show("The new document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
	 
	
 
Example
How to utilize a title property of a newly created tag element.
            
            Dim caption As String = "Example: SetTagTitle"
            Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
                Dim message As String = ""
                If (gdpicturePDF.NewPDF(PdfConformance.PDF_UA_1) = GdPictureStatus.OK) AndAlso
                   (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) Then
                    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
                    'This is required to have a valid PDF_UA document.
                    gdpicturePDF.SetTitle("My first PDF/UA document")
                    Dim fontResName As String = gdpicturePDF.AddTrueTypeFontU("Arial", False, False, False)
                    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
                        message = "Setting text properties has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    Dim tagRootID As Integer = gdpicturePDF.GetTagRootID()
                    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
                        message = "The GetTagRootID() method has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Creating a parent tag of the type 'Div' that will hold both the form field and its caption.
                    Dim divTag As Integer = gdpicturePDF.NewTag(tagRootID, "Div")
                    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
                        message = "The NewTag(Div) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Creating a tag of the type 'Caption'.
                    Dim captionTag As Integer = gdpicturePDF.NewTag(divTag, "Caption")
                    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
                        message = "The NewTag(Caption) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Drawing a caption for the text form field.
                    If (gdpicturePDF.BeginMarkedContentSequence(captionTag, "Span") <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.DrawText(fontResName, 100, 70, "Your toolkit is: ") <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.EndMarkedContent() <> GdPictureStatus.OK) Then
                        message = "The creation of the marked content sequence has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Creating a tag of the type 'Form'.
                    Dim formTag As Integer = gdpicturePDF.NewTag(divTag, "Form")
                    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
                        message = "The NewTag(Form) method has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Creating a text form field.
                    Dim formID As Integer = gdpicturePDF.AddTextFormField(220, 50, 150, 30, "TextField_Name", "GdPicture14", False, fontResName, 20, Color.Brown)
                    If (gdpicturePDF.GetStat() <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.SetFormFieldBackgroundColor(formID, Color.White) <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.SetFormFieldBorderColor(formID, Color.Brown) <> GdPictureStatus.OK) Then
                        message = "The NewTag(Caption) method has failed. status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    'Attaching the prepared tag to the new text form field.
                    If (gdpicturePDF.AttachTagToFormField(formTag, formID) <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.SetTagTitle(formTag, "Name Field") <> GdPictureStatus.OK) OrElse
                       (gdpicturePDF.SetFormFieldAlternateTitle(formID, "Name Field") <> GdPictureStatus.OK) Then
                        message = "Attaching the tag to the form field has failed. Status: " + gdpicturePDF.GetStat().ToString()
                        GoTo [error]
                    End If
                    If gdpicturePDF.SaveToFile("test_tagged.pdf") = GdPictureStatus.OK Then
                        message = "Your tagged document has been successfully created."
                    Else
                        message = "The example has been successfully followed, but the SaveToFile() method has failed. Status: " + gdpicturePDF.GetStat().ToString()
                    End If
            [error]:
                    MessageBox.Show(message, caption)
                    gdpicturePDF.CloseDocument()
                Else
                    MessageBox.Show("The new document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)
                End If
            End Using
            
            string caption = "Example: SetTagTitle";
            using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
            {
                string message = "";
                if ((gdpicturePDF.NewPDF(PdfConformance.PDF_UA_1) == GdPictureStatus.OK) &&
                    (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK))
                {
                    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
                    //This is required to have a valid PDF_UA document.
                    gdpicturePDF.SetTitle("My first PDF/UA document");
                    string fontResName = gdpicturePDF.AddTrueTypeFontU("Arial", false, false, false);
                    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
                    {
                        message = "Setting text properties has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    int tagRootID = gdpicturePDF.GetTagRootID();
                    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
                    {
                        message = "The GetTagRootID() method has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Creating a parent tag of the type 'Div' that will hold both the form field and its caption.
                    int divTag = gdpicturePDF.NewTag(tagRootID, "Div");
                    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
                    {
                        message = "The NewTag(Div) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Creating a tag of the type 'Caption'.
                    int captionTag = gdpicturePDF.NewTag(divTag, "Caption");
                    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
                    {
                        message = "The NewTag(Caption) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Drawing a caption for the text form field.
                    if ((gdpicturePDF.BeginMarkedContentSequence(captionTag, "Span") != GdPictureStatus.OK) ||
                        (gdpicturePDF.DrawText(fontResName, 100, 70, "Your toolkit is: ") != GdPictureStatus.OK) ||
                        (gdpicturePDF.EndMarkedContent() != GdPictureStatus.OK))
                    {
                        message = "The creation of the marked content sequence has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Creating a tag of the type 'Form'.
                    int formTag = gdpicturePDF.NewTag(divTag, "Form");
                    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
                    {
                        message = "The NewTag(Form) method has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Creating a text form field.
                    int formID = gdpicturePDF.AddTextFormField(220, 50, 150, 30, "TextField_Name", "GdPicture14", false, fontResName, 20, Color.Brown);
                    if ((gdpicturePDF.GetStat() != GdPictureStatus.OK) ||
                        (gdpicturePDF.SetFormFieldBackgroundColor(formID, Color.White) != GdPictureStatus.OK) ||
                        (gdpicturePDF.SetFormFieldBorderColor(formID, Color.Brown) != GdPictureStatus.OK))
                    {
                        message = "The NewTag(Caption) method has failed. status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    //Attaching the prepared tag to the new text form field.
                    if ((gdpicturePDF.AttachTagToFormField(formTag, formID) != GdPictureStatus.OK) ||
                        (gdpicturePDF.SetTagTitle(formTag, "Name Field") != GdPictureStatus.OK) ||
                        (gdpicturePDF.SetFormFieldAlternateTitle(formID, "Name Field") != GdPictureStatus.OK))
                    {
                        message = "Attaching the tag to the form field has failed. Status: " + gdpicturePDF.GetStat().ToString();
                        goto error;
                    }
                    if (gdpicturePDF.SaveToFile("test_tagged.pdf") == GdPictureStatus.OK)
                        message = "Your tagged document has been successfully created.";
                    else
                        message = "The example has been successfully followed, but the SaveToFile() method has failed. Status: " + gdpicturePDF.GetStat().ToString();
                    error:
                    MessageBox.Show(message, caption);
                    gdpicturePDF.CloseDocument();
                }
                else
                    MessageBox.Show("The new document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption);
            }
            
            
            
            See Also