GetPagePrivateTag Method (GdPicturePDF)
In This Topic
Returns a value for the private tag linked with the currently selected page of the loaded PDF document, specified by its name.
Syntax
'Declaration
Public Function GetPagePrivateTag( _
ByVal As String _
) As String
public string GetPagePrivateTag(
string
)
public function GetPagePrivateTag(
: String
): String;
public function GetPagePrivateTag(
: String
) : String;
public: string* GetPagePrivateTag(
string*
)
public:
String^ GetPagePrivateTag(
String^
)
Parameters
- Tag
- The name of the private tag for the current page, for example "Origin".
Return Value
The private page tag value previously defined by the
GdPicturePDF.SetPagePrivateTag method. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to determine the values for the private tag named MyTag linked with each page of your document.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim message As String = "", content As String = ""
For i As Integer = 1 To count
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
content = gdpicturePDF.GetPagePrivateTag("MyTag")
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
message = message + "The value of the MyTag for the page nr." + i.ToString() + " is : " + content + vbCrLf
Else
message = message + "The GetPagePrivateTag() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + vbCrLf
End If
Else
message = message + "The SelectPage() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + vbCrLf
End If
Next
MessageBox.Show(message, "Example: GetPagePrivateTag")
Else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), "Example: GetPagePrivateTag")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetPagePrivateTag")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
string message = "", content = "";
for (int i = 1; i <= count; i++)
{
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
content = gdpicturePDF.GetPagePrivateTag("MyTag");
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
message = message + "The value of the MyTag for the page nr." + i.ToString() + " is : " + content + "\n";
else
message = message + "The GetPagePrivateTag() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + "\n";
}
else
message = message + "The SelectPage() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + "\n";
}
MessageBox.Show(message, "Example: GetPagePrivateTag");
}
else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), "Example: GetPagePrivateTag");
}
else
MessageBox.Show("The file can't be loaded.", "Example: GetPagePrivateTag");
gdpicturePDF.Dispose();
Example
How to determine the values for the private tag named MyTag linked with each page of your document.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim message As String = "", content As String = ""
For i As Integer = 1 To count
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
content = gdpicturePDF.GetPagePrivateTag("MyTag")
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
message = message + "The value of the MyTag for the page nr." + i.ToString() + " is : " + content + vbCrLf
Else
message = message + "The GetPagePrivateTag() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + vbCrLf
End If
Else
message = message + "The SelectPage() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + vbCrLf
End If
Next
MessageBox.Show(message, "Example: GetPagePrivateTag")
Else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), "Example: GetPagePrivateTag")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetPagePrivateTag")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
string message = "", content = "";
for (int i = 1; i <= count; i++)
{
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
content = gdpicturePDF.GetPagePrivateTag("MyTag");
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
message = message + "The value of the MyTag for the page nr." + i.ToString() + " is : " + content + "\n";
else
message = message + "The GetPagePrivateTag() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + "\n";
}
else
message = message + "The SelectPage() method has failed for the page nr." + i.ToString() + " with the status: " + status.ToString() + "\n";
}
MessageBox.Show(message, "Example: GetPagePrivateTag");
}
else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), "Example: GetPagePrivateTag");
}
else
MessageBox.Show("The file can't be loaded.", "Example: GetPagePrivateTag");
gdpicturePDF.Dispose();
See Also