Delete PDF Metadata with C# REST API

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

Steps to Clean Metadata from PDF with C# REST Interface

  1. Instantiate the PdfApi object by setting the API key and App SID for removing custom properties
  2. Load the target PDF file into the Document object having custom properties
  3. Call the DeleteProperties() method to delete the custom properties
  4. Display the stripped-down list of the properties if required using the pdfApi.GetDocumentProperties() method
  5. 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.