This article describes how to delete PDF metadata with C# REST API. You will learn to automatically remove metadata from PDF with C# Low Code API using the .NET-based Cloud SDK. Details will also be shared to work with the PDF file metadata such as inserting and deleting the custom file properties.
Prerequisite
- Create an account API credentials
- Download Aspose.PDF Cloud SDK for Dotnet to delete custom metadata
- Setup C# project with the above SDK for erasing the file properties
Steps to Clean Metadata from PDF with C# REST Interface
- Instantiate the PdfApi object by setting the API key and App SID for removing custom properties
- Load the target PDF file into the Document object having custom properties
- Call the DeleteProperties() method to delete the custom properties
- Display the stripped-down list of the properties if required using the pdfApi.GetDocumentProperties() method
- Download the updated PDF file
The above steps summarize the process of developing a PDF properties remover with C# Low Code API. Call the UploadFile() method to upload the target PDF file and call the DeleteProperties() method to delete the custom properties. Note that you cannot remove the built-in properties but can erase the values using the pdfApi.PutSetProperty() method and setting the Value attribute to null.
Code to Strip PDF Metadata with C# RESTful Service
This code has shown how to clean PDF metadata with C# .NET-based API. If you want to add a new custom property, you may use pdfApi.PutSetProperty() method that checks if the property with this name is available, then updates its value, otherwise, add it as a custom property. If you want to display the current set of properties in the PDF file, use the GetDocumentProperties() method and iterate through the list in the API response.
This article has taught us the process of deleting all the custom properties in the PDF file. If you want to add new custom properties or set values of the existing properties, refer to the article on Update PDF metadata with C# REST API.