GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / SetTagActualText Method
A unique tag identifier of the tag's tree element.
The new actual text of the specified tag's tree element.
Example





SetTagActualText Method (GdPicturePDF)
Sets the actual text of a 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 an exact replacement text for such content, that is represented in a nonstandard way. Generally, it should apply to as small piece of content as possible.

Syntax
'Declaration
 
Public Function SetTagActualText( _
   ByVal TagID As Integer, _
   ByVal ActualText As String _
) As GdPictureStatus
 

Parameters

TagID
A unique tag identifier of the tag's tree element.
ActualText
The new actual text 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.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to utilize an actual text property of a newly created tag element.
Dim caption As String = "Example: SetTagLanguage"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    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, True)
        If (gdpicturePDF.GetStat() = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetFillColor(Color.Blue) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.SetTextSize(16) = GdPictureStatus.OK) Then
            Dim tagRootID As Integer = gdpicturePDF.GetTagRootID()
            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                'Setting the natural language for the whole document.
                gdpicturePDF.SetLanguage("en-US")
                Dim tagParagraph As Integer = gdpicturePDF.NewTag(tagRootID, "P")
                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                    'Setting the language for the drawn text in the paragraph tag.
                    If (gdpicturePDF.SetTagLanguage(tagParagraph, "es-MX") = GdPictureStatus.OK) AndAlso
                       (gdpicturePDF.SetTagActualText(tagParagraph, "Hasta la vista.") = GdPictureStatus.OK) AndAlso
                       (gdpicturePDF.BeginMarkedContentSequence(tagParagraph, "P") = GdPictureStatus.OK) AndAlso
                       (gdpicturePDF.DrawText(fontResName, 50, 50, "Hasta la vista.") = GdPictureStatus.OK) AndAlso
                       (gdpicturePDF.EndMarkedContent() = GdPictureStatus.OK) Then
                        Dim status As GdPictureStatus = gdpicturePDF.SaveToFile("test_tagged.pdf")
                        If status = GdPictureStatus.OK Then
                            MessageBox.Show("Your new PDF document has been successfully created.", caption)
                        Else
                            MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption)
                        End If
                    Else
                        MessageBox.Show("Tagging of the paragraph has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
                    End If
                Else
                    MessageBox.Show("The NewTag() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
                End If
            Else
                MessageBox.Show("The GetTagRootID() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
            End If
        Else
            MessageBox.Show("Setting text properties has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
        End If
        gdpicturePDF.CloseDocument()
    Else
        MessageBox.Show("The new document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
End Using
See Also