GetMetadata Method (GdPicturePDF)
In This Topic
Returns the metadata of the currently loaded PDF document, if any are stored in the PDF.
The toolkit supports XMP format of metadata, which is the standard for embedding metadata in files. For further assistance, please refer to the core XMP specification published as ISO standard 16684-1.
Syntax
'Declaration
Public Function GetMetadata() As String
public string GetMetadata()
public function GetMetadata(): String;
public function GetMetadata() : String;
public: string* GetMetadata();
public:
String^ GetMetadata();
Return Value
The value of the document's metadata as a string in the XMP standardized format. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to find out the metadata of the PDF document.
Using gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim metadata As String = gdpicturePDF.GetMetadata()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("The metadata of this PDF are:" + vbCrLf + metadata, "Example: GetMetadata")
Else
MessageBox.Show("The GetMetadata() method has failed with the status: " + status.ToString(), "Example: GetMetadata")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetMetadata")
End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
string metadata = gdpicturePDF.GetMetadata();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
MessageBox.Show("The metadata of this PDF are:\n" + metadata, "Example: GetMetadata");
}
else
{
MessageBox.Show("The GetMetadata() method has failed with the status: " + status.ToString(), "Example: GetMetadata");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: GetMetadata");
}
}
Example
How to find out the metadata of the PDF document.
Using gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim metadata As String = gdpicturePDF.GetMetadata()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("The metadata of this PDF are:" + vbCrLf + metadata, "Example: GetMetadata")
Else
MessageBox.Show("The GetMetadata() method has failed with the status: " + status.ToString(), "Example: GetMetadata")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: GetMetadata")
End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
string metadata = gdpicturePDF.GetMetadata();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
MessageBox.Show("The metadata of this PDF are:\n" + metadata, "Example: GetMetadata");
}
else
{
MessageBox.Show("The GetMetadata() method has failed with the status: " + status.ToString(), "Example: GetMetadata");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: GetMetadata");
}
}
See Also