GetCustomPDFInformation Method (GdPicturePDF)
In This Topic
Returns a string containing the value of the specified custom information key (the custom metadata field) in the currently loaded PDF document.
Syntax
'Declaration
Public Function GetCustomPDFInformation( _
ByVal As String _
) As String
public string GetCustomPDFInformation(
string
)
public function GetCustomPDFInformation(
: String
): String;
public function GetCustomPDFInformation(
: String
) : String;
public: string* GetCustomPDFInformation(
string*
)
public:
String^ GetCustomPDFInformation(
String^
)
Parameters
- Key
- The name of the required custom information key.
Return Value
The value of the specified custom information key as a string. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to find out the names of the custom metadata fields and their values if they are specified in the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim keys As String = gdpicturePDF.GetCustomPDFInformationKeys(vbCrLf)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If keys.Equals("") Then
MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: GetCustomPDFInformation")
Else
MessageBox.Show("All custom keys are:" + vbCrLf + keys, "Example: GetCustomPDFInformation")
Dim value As String = ""
Dim outPut As String = ""
Dim keyTable As String() = Split(keys, vbCrLf)
For x As Integer = 0 To keyTable.Length - 1
value = gdpicturePDF.GetCustomPDFInformation(keyTable(x))
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
outPut = outPut + keyTable(x) + " = " + value + vbCrLf
Else
MessageBox.Show("The GetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation")
End If
Next
MessageBox.Show("Custom keys and values are:" + vbCrLf + outPut, "Example: GetCustomPDFInformation")
End If
Else
MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetCustomPDFInformation")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string keys = gdpicturePDF.GetCustomPDFInformationKeys("\n");
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (keys.Equals(""))
{
MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: GetCustomPDFInformation");
}
else
{
MessageBox.Show("All custom keys are:\n" + keys, "Example: GetCustomPDFInformation");
string[] names = keys.Split('\n');
string value = "";
string output = "";
foreach (var name in names)
{
value = gdpicturePDF.GetCustomPDFInformation(name);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
output = output + name + " = " + value + "\n";
}
else
{
MessageBox.Show("The GetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation");
}
}
MessageBox.Show("Custom keys and values are:\n" + output, "Example: GetCustomPDFInformation");
}
}
else
{
MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: GetCustomPDFInformation");
}
gdpicturePDF.Dispose();
Example
How to find out the names of the custom metadata fields and their values if they are specified in the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim keys As String = gdpicturePDF.GetCustomPDFInformationKeys(vbCrLf)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If keys.Equals("") Then
MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: GetCustomPDFInformation")
Else
MessageBox.Show("All custom keys are:" + vbCrLf + keys, "Example: GetCustomPDFInformation")
Dim value As String = ""
Dim outPut As String = ""
Dim keyTable As String() = Split(keys, vbCrLf)
For x As Integer = 0 To keyTable.Length - 1
value = gdpicturePDF.GetCustomPDFInformation(keyTable(x))
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
outPut = outPut + keyTable(x) + " = " + value + vbCrLf
Else
MessageBox.Show("The GetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation")
End If
Next
MessageBox.Show("Custom keys and values are:" + vbCrLf + outPut, "Example: GetCustomPDFInformation")
End If
Else
MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetCustomPDFInformation")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string keys = gdpicturePDF.GetCustomPDFInformationKeys("\n");
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (keys.Equals(""))
{
MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: GetCustomPDFInformation");
}
else
{
MessageBox.Show("All custom keys are:\n" + keys, "Example: GetCustomPDFInformation");
string[] names = keys.Split('\n');
string value = "";
string output = "";
foreach (var name in names)
{
value = gdpicturePDF.GetCustomPDFInformation(name);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
output = output + name + " = " + value + "\n";
}
else
{
MessageBox.Show("The GetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation");
}
}
MessageBox.Show("Custom keys and values are:\n" + output, "Example: GetCustomPDFInformation");
}
}
else
{
MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: GetCustomPDFInformation");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: GetCustomPDFInformation");
}
gdpicturePDF.Dispose();
See Also