This guide shows how to Python developers can programmatically remove PDF metadata using the Aspose.PDF Cloud REST API, leveraging the official Python SDK to delete custom document properties in a few simple steps. For more information about the PDF format, see the PDF file info page.
Prerequisite
- Create an account API credentials
- Download the Aspose.PDF Cloud SDK for Python
- Set up a Python project with the SDK to erase file properties
Steps to Clean Metadata from PDF with Python REST Interface
- Instantiate the PdfApi object by providing your API key and App SID.
- Load the target PDF file into a Document object that contains custom properties.
- Call the DeleteProperties() method to remove the custom properties.
- If needed, retrieve the remaining properties with pdfApi.get_document_properties().
- Download the updated PDF file.
The steps above outline the creation of a PDF properties remover using the Python Low‑Code API. First upload the PDF with upload_file(), then invoke delete_properties() to clear the custom entries. Built‑in properties cannot be removed directly, but you can clear their values by using pdfApi.put_set_property() and setting the value to null.
Code to Strip PDF Metadata with Python RESTful Service
The snippet demonstrates how to clean PDF metadata with the Python‑based API. To add a new custom property, use pdfApi.put_set_property()—the method will update the value if the property exists or create it otherwise. To list the current properties, call get_document_properties() and iterate over the response.
This article covered deleting all custom properties from a PDF file. For adding or updating metadata, refer to the article on Update PDF metadata with Python REST API.
Keywords: delete pdf metadata with Python REST API; remove metadata from pdf with Python Low Code API; clean pdf metadata with Python-based API; pdf properties remover with Python Low Code API.