GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / DeleteCustomPDFInformation Method
The name of the custom information key (the custom metadata field) to remove.
Example





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

Parameters

Key
The name of the custom information key (the custom metadata field) to remove.

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 delete a custom metadata field specified by its key name from the PDF document.
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim keys As String = gdpicturePDF.GetCustomPDFInformationKeys("~")
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        If keys.Equals("") Then
            MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: DeleteCustomPDFInformation")
        Else
            If keys.Contains("gdpicture") Then
                status = gdpicturePDF.DeleteCustomPDFInformation("gdpicture")
                If status = GdPictureStatus.OK Then
                    status = gdpicturePDF.SaveToFile("test_DeleteMetaData.pdf")
                    If status = GdPictureStatus.OK Then
                        MessageBox.Show("The example has been followed successfully and the file has been saved.", "Example: DeleteCustomPDFInformation")
                    Else
                        MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), "Example: DeleteCustomPDFInformation")
                    End If
                Else
                    MessageBox.Show("The DeleteCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: DeleteCustomPDFInformation")
                End If
            Else
                MessageBox.Show("Your PDF document does not contain custom key gdpicture.", "Example: DeleteCustomPDFInformation")
            End If
        End If
    Else
        MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: DeleteCustomPDFInformation")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: DeleteCustomPDFInformation")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    string keys = gdpicturePDF.GetCustomPDFInformationKeys("~");
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        if (keys.Equals(""))
        {
            MessageBox.Show("Your PDF document does not contain any custom keys.", "Example: DeleteCustomPDFInformation");
        }
        else
        {
            if (keys.Contains("gdpicture"))
            {
                status = gdpicturePDF.DeleteCustomPDFInformation("gdpicture");
                if (status == GdPictureStatus.OK)
                {
                    status = gdpicturePDF.SaveToFile("test_DeleteMetaData.pdf");
                    if (status == GdPictureStatus.OK)
                        MessageBox.Show("The example has been followed successfully and the file has been saved.", "Example: DeleteCustomPDFInformation");
                    else
                        MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), "Example: DeleteCustomPDFInformation");
                }
                else
                    MessageBox.Show("The DeleteCustomPDFInformation() method has failed with the status: " + status.ToString(), "Example: DeleteCustomPDFInformation");
            }
            else
                MessageBox.Show("Your PDF document does not contain custom key gdpicture.", "Example: DeleteCustomPDFInformation");
        }
    }
    else
    {
        MessageBox.Show("The GetCustomPDFInformationKeys() method has failed with the status: " + status.ToString(), "Example: DeleteCustomPDFInformation");
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", "Example: DeleteCustomPDFInformation");
}
gdpicturePDF.Dispose();
See Also