A PDF's Properties window is only one view of the file. Clearing the author or title shown there may leave another metadata representation, an attachment or information inside an embedded object. Before writing a PDF cleaner in Python, define what you intend to remove and what document features must survive.

A useful starting distinction is document metadata versus document content. The Info dictionary and a document-level XMP stream can describe authorship or software history. Text printed on a page, form values, annotations and embedded files are separate structures. A metadata recipe should state its scope clearly.

PYPDF: DOCUMENT INFO IS NOT THE WHOLE FILE

pypdf provides access to the conventional metadata dictionary and XMP information. Its metadata property concerns the Info entry; clearing that property alone should not be presented as a complete PDF sanitization process.

For a basic, explicitly limited Info-removal operation:

from pypdf import PdfWriter

writer = PdfWriter(clone_from="input.pdf")
writer.metadata = None
writer.write("without-info.pdf")

This writes a separate output and targets document Info metadata. Inspect XMP and other objects independently. Avoid saying "all hidden information removed" on the strength of this operation.

PIKEPDF: REMOVE BOTH DOCUMENT-LEVEL STORES

pikepdf offers direct access to the PDF object structure. Its documentation describes removal of the document XMP stream and document information dictionary. A targeted recipe is:

import pikepdf

with pikepdf.open("input.pdf") as pdf:
if "/Metadata" in pdf.Root:
del pdf.Root["/Metadata"]
del pdf.docinfo
pdf.save("document-metadata-clean.pdf", fix_metadata_version=False)

The save option matters because pikepdf can otherwise create or update version-related XMP metadata. This example targets the two document-level metadata stores. It does not inspect every image, annotation, attachment, form field or custom structure inside the PDF.

WHAT ABOUT A PDF CLEANING API?

An API can move dependency installation, document parsing and operational maintenance to a service provider. It also changes the privacy boundary: a remote API may receive the actual document. Read the provider's file-retention terms and failure behaviour, and verify precisely which document features the endpoint removes.

Use a real documented endpoint and authentication method rather than copying an invented URL into production. StripAITags does not advertise a PDF-cleaning developer API in this guide. Its browser tool is a separate option, not a drop-in Python library or an API credential service.

WHEN FLATTENING IS APPROPRIATE

Rendering visible pages into images and building a fresh PDF creates a different trade-off. The result can lose searchable text, accessibility structure, active forms and valid digital signatures. Removing signatures or rewriting a signed document can also affect the evidence the file was intended to preserve.

The StripAITags PDF cleaner at https://stripaitags.com/tools?tool=pdf uses a browser-based flattened export workflow. Review its current limits and check the output page by page. Flattening is not redaction: a visible address, account number or signature can remain on the rendered page.

VERIFY AGAINST A WRITTEN CHECKLIST

Use documents representative of your actual work: an office export, a scanned PDF, a form and a file containing photographs or attachments. Compare page count, appearance, text selection and required interactive features. Inspect both Info and XMP, then examine any additional structures included in your removal policy.

For routine author-field cleanup, a narrow library operation may be enough. For confidential disclosure, define the broader review process first. The useful question is not simply which package removes metadata, but which checked output meets the purpose of sharing that document.

Further reading
pypdf metadata guide: https://pypdf.readthedocs.io/en/stable/user/metadata.html
pikepdf metadata handling: https://pikepdf.readthedocs.io/en/stable/topics/metadata.html
pikepdf sanitization scope: https://pikepdf.readthedocs.io/en/latest/topics/sanitize.html