How to remove EXIF metadata from PDFs using an API
PDFs can contain embedded metadata (EXIF, XMP, document properties). The PDF Squeezer API can strip this metadata to reduce file size and improve privacy.
Why strip metadata?
Metadata can include creator info, GPS, timestamps, and software used. Removing it reduces size and avoids leaking sensitive data when you share or store PDFs.
Using stripMetadata
Set stripMetadata=true (default) on the compress endpoint. The API removes metadata from the PDF and embedded images.
curl -X POST https://api.pdfsqueezer.io/v1/compress \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "stripMetadata=true" \
-o document_clean.pdf
Python example
import requests
files = {'file': open('document.pdf', 'rb')}
headers = {'Authorization': f'Bearer {os.environ["PDF_SQUEEZER_KEY"]}'}
params = {'stripMetadata': True} # also reduces size
r = requests.post('https://api.pdfsqueezer.io/v1/compress', files=files, headers=headers, params=params)
with open('document_clean.pdf', 'wb') as f:
f.write(r.content)