GdPicture.NET Reference Guide
BeginMarkedContent Method (GdPicturePDF)
Example 





GdPicture14 Namespace > GdPicturePDF Class : BeginMarkedContent Method
A name of the structure type for the newly created marked content element.

Please refer to the PDF Reference, the Standard Structure Types section, for the names of the standard structure types.

Begins a marked content of operations in the page content associated to a structure element of the required structure type related to the document's tag structure tree of the currently loaded PDF document.
Syntax
'Declaration
 
Public Function BeginMarkedContent( _
   ByVal StructType As String _
) As GdPictureStatus
public GdPictureStatus BeginMarkedContent( 
   string StructType
)
public function BeginMarkedContent( 
    StructType: String
): GdPictureStatus; 
public function BeginMarkedContent( 
   StructType : String
) : GdPictureStatus;
public: GdPictureStatus BeginMarkedContent( 
   string* StructType
) 
public:
GdPictureStatus BeginMarkedContent( 
   String^ StructType
) 

Parameters

StructType
A name of the structure type for the newly created marked content element.

Please refer to the PDF Reference, the Standard Structure Types section, for the names of the standard structure types.

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
Please note that this method is only allowed for use with non-encrypted documents.
Example
How to create a marked content structure element of the Artifact category containing some graphics.
Dim caption As String = "Example: BeginMarkedContent"
Using oGdPicturePDF As GdPicturePDF = New GdPicturePDF()
    If (oGdPicturePDF.NewPDF(PdfConformance.PDF_UA_1) = GdPictureStatus.OK) AndAlso
       (oGdPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) Then
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
        'This is required to have a valid PDF_UA document.
        oGdPicturePDF.SetTitle("My first PDF/UA document")
        Dim fontResName As String = oGdPicturePDF.AddTrueTypeFontU("Arial", False, False, True)
        If (oGdPicturePDF.GetStat() = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillColor(Color.Blue) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetTextSize(16) = GdPictureStatus.OK) Then
            Dim tagRootID As Integer = oGdPicturePDF.GetTagRootID()
            If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
                Dim tagParagraph As Integer = oGdPicturePDF.NewTag(tagRootID, "P")
                If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
                    If (oGdPicturePDF.BeginMarkedContentSequence(tagParagraph, "P") = GdPictureStatus.OK) AndAlso
                       (oGdPicturePDF.DrawText(fontResName, 50, 50, "This is text that is tagged as paragraph!") = GdPictureStatus.OK) AndAlso
                       (oGdPicturePDF.EndMarkedContent() = GdPictureStatus.OK) AndAlso
                       (oGdPicturePDF.BeginMarkedContent("Artifact") = GdPictureStatus.OK) AndAlso
                       (oGdPicturePDF.DrawLine(50, 55, 330, 55) = GdPictureStatus.OK) AndAlso
                       (oGdPicturePDF.EndMarkedContent() = GdPictureStatus.OK) Then
                        Dim status As GdPictureStatus = oGdPicturePDF.SaveToFile("test_tagged.pdf")
                        If status = GdPictureStatus.OK Then
                            MessageBox.Show("Your tagged 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: " + oGdPicturePDF.GetStat().ToString(), caption)
                    End If
                Else
                    MessageBox.Show("The NewTag() method has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption)
                End If
            Else
                MessageBox.Show("The GetTagRootID() method has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption)
            End If
        Else
            MessageBox.Show("Setting text properties has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption)
        End If
 
        oGdPicturePDF.CloseDocument()
    Else
        MessageBox.Show("The new document can't be created. Status: " + oGdPicturePDF.GetStat().ToString(), caption)
    End If
End Using
string caption = "Example: BeginMarkedContent";
using (GdPicturePDF oGdPicturePDF = new GdPicturePDF())
{
    if ((oGdPicturePDF.NewPDF(PdfConformance.PDF_UA_1) == GdPictureStatus.OK) &&
        (oGdPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK))
    {
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
        //This is required to have a valid PDF_UA document.
        oGdPicturePDF.SetTitle("My first PDF/UA document");
        string fontResName = oGdPicturePDF.AddTrueTypeFontU("Arial", false, false, true);
        if ((oGdPicturePDF.GetStat() == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillColor(Color.Blue) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetTextSize(16) == GdPictureStatus.OK))
        {
            int tagRootID = oGdPicturePDF.GetTagRootID();
            if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
            {
                int tagParagraph = oGdPicturePDF.NewTag(tagRootID, "P");
                if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
                {
                    if ((oGdPicturePDF.BeginMarkedContentSequence(tagParagraph, "P") == GdPictureStatus.OK) &&
                        (oGdPicturePDF.DrawText(fontResName, 50, 50, "This is text that is tagged as paragraph!") == GdPictureStatus.OK) &&
                        (oGdPicturePDF.EndMarkedContent() == GdPictureStatus.OK) &&
                        (oGdPicturePDF.BeginMarkedContent("Artifact") == GdPictureStatus.OK) &&
                        (oGdPicturePDF.DrawLine(50, 55, 330, 55) == GdPictureStatus.OK) &&
                        (oGdPicturePDF.EndMarkedContent() == GdPictureStatus.OK))
                    {
                        GdPictureStatus status = oGdPicturePDF.SaveToFile("test_tagged.pdf");
                        if (status == GdPictureStatus.OK)
                            MessageBox.Show("Your tagged PDF document has been successfully created.", caption);
                        else
                            MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption);
                    }
                    else
                        MessageBox.Show("Tagging of the paragraph has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption);
                }
                else
                    MessageBox.Show("The NewTag() method has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption);
            }
            else
                MessageBox.Show("The GetTagRootID() method has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption);
        }
        else
            MessageBox.Show("Setting text properties has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption);
        oGdPicturePDF.CloseDocument();
    }
    else
        MessageBox.Show("The new document can't be created. Status: " + oGdPicturePDF.GetStat().ToString(), caption);
}
See Also

Reference

GdPicturePDF Class
GdPicturePDF Members
GetTagRootID Method
BeginMarkedContentSequence Method
BeginMarkedContent Method
EndMarkedContent Method