SetCustomPDFInformation Method (GdPicturePDF)
Adds the pair - the custom information key name and its value - to already defined custom metadata fields of the currently loaded PDF document.
public function SetCustomPDFInformation(
: String;
: String
): GdPictureStatus;
public function SetCustomPDFInformation(
: String,
: String
) : GdPictureStatus;
'Declaration
Public Function SetCustomPDFInformation( _
ByVal As String, _
ByVal As String _
) As GdPictureStatus
Parameters
- Key
- The name of the custom information key (the custom metadata field).
- Value
- The value of the specified custom information key.
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.
How to add a new custom metadata pair key-value to the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SetCustomPDFInformation("NewKey", "NewValue")
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_SetMetaData_func.pdf")
If status = GdPictureStatus.OK Then
'You can use the GetCustomPDFInformationKeys and GetCustomPDFInformation methods to check your custom metadata fields.
MessageBox.Show("Your custom metadata has been added successfully.", "Example: SetCustomPDFInformation")
End If
Else
MessageBox.Show("The SetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: SetCustomPDFInformation")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: SetCustomPDFInformation")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SetCustomPDFInformation("NewKey", "NewValue");
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_SetMetaData_func.pdf");
if (status == GdPictureStatus.OK)
{
MessageBox.Show("Your custom metadata has been added successfully.", "Example: SetCustomPDFInformation");
//You can use the GetCustomPDFInformationKeys and GetCustomPDFInformation methods to check your custom metadata fields.
}
}
else
{
MessageBox.Show("The SetCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: SetCustomPDFInformation");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: SetCustomPDFInformation");
}
gdpicturePDF.Dispose();