GdPicture.NET Reference Guide
IPTCCount Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : IPTCCount Method
Returns the total number of IPTC tags embedded within the document displayed in the GdViewer control. These tags, also known as document's metadata, allows for additional information to be stored within a document.
Syntax
'Declaration
 
Public Function IPTCCount() As Integer
public int IPTCCount()
public function IPTCCount(): Integer; 
public function IPTCCount() : int;
public: int IPTCCount(); 
public:
int IPTCCount(); 

Return Value

The total number of IPTC tags embedded within the displayed document. Please always use the GetStat method to determine if this method has been successful.
Remarks
We strongly recommend using the GetStat method to identify the specific reason for the method's failure.

Be aware that this method only handles IPTC tags.

Example
How to find out the number of IPTC tags embedded in the displayed document.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
Dim count As Integer = GdViewer1.IPTCCount()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
    Dim message As String = "IPTC Tags count: " + count + vbCrLf
    Dim tagID As IPTCTags = IPTCTags.IPTCTagUnknown
    Dim tagValue As String = ""
    For i As Integer = 1 To count
        tagID = GdViewer1.IPTCGetID(i)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            tagValue = GdViewer1.TagGetValueString(i)
        End If
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            message = message + vbCrLf + tagID + ": " + tagValue
        Else
            message = message + vbCrLf + "Tag nr." + i + "  Status: " + GdViewer1.GetStat().ToString()
        End If
    Next
    MessageBox.Show(message, "GdViewer.IPTCCount")
Else
    MessageBox.Show("The number of IPTC tags can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IPTCCount")
End If
//We assume that the GdViewer1 control has been properly integrated.
//and your document has been properly displayed as well.
int count = GdViewer1.IPTCCount();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
    string message = "IPTC Tags count: " + count + "\n";
    IPTCTags tagID = IPTCTags.IPTCTagUnknown;
    string tagValue = "";
    for (int i = 1; i <= count; i++)
    {
        tagID = GdViewer1.IPTCGetID(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            tagValue = GdViewer1.TagGetValueString(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            message = message + "\n" + tagID + ": " + tagValue;
        else
            message = message + ("\nTag nr." + i + "  Status: " + GdViewer1.GetStat().ToString();
    }
    MessageBox.Show(message, "GdViewer.IPTCCount");
}
else
    MessageBox.Show("The number of IPTC tags can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IPTCCount");
See Also

Reference

GdViewer Class
GdViewer Members
IPTCGetID Method
IPTCGetValueString Method
TagCount Method