GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetCustomPDFInformation Method
The name of the custom information key (the custom metadata field).
The value of the specified custom information key.
Example





In This Topic
SetCustomPDFInformation Method (GdPicturePDF)
In This Topic
Adds the pair - the custom information key name and its value - to already defined custom metadata fields of the currently loaded PDF document.
Syntax
'Declaration
 
Public Function SetCustomPDFInformation( _
   ByVal Key As String, _
   ByVal Value As String _
) As GdPictureStatus
public GdPictureStatus SetCustomPDFInformation( 
   string Key,
   string Value
)
public function SetCustomPDFInformation( 
    Key: String;
    Value: String
): GdPictureStatus; 
public function SetCustomPDFInformation( 
   Key : String,
   Value : String
) : GdPictureStatus;
public: GdPictureStatus SetCustomPDFInformation( 
   string* Key,
   string* Value
) 
public:
GdPictureStatus SetCustomPDFInformation( 
   String^ Key,
   String^ Value
) 

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.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
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();
See Also