Free plan
Sanitize PDF
Remove scripts, attachments and hidden extras from a PDF
About this tool
This tool cleans a PDF of things that can run by themselves or reveal more than you meant to share. It removes scripts (small programs inside the file), automatic actions, attached files and embedded video or sound. You can also remove web links and the document details such as author. The result tells you what was removed.
For example, a PDF came from someone you do not fully trust, so you clean it before opening or forwarding it.
How to use it
- Choose this tool.
- Add your PDF.
- Choose what to remove: scripts, actions, attachments, embedded media, links, or document details.
- Press Generate.
- Download the cleaned PDF and read what was removed.
What you get back
You get a cleaned copy of the PDF and a list of what was removed. You can download it.
GOOD TO KNOW
A PDF in, a cleaned PDF out. An encrypted file must be unlocked first. Counts as one file.
TEST IT LIVE
Try Sanitize PDF in the Studio
One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/sanitize
Tool ID
pdfs.sanitize
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/sanitize" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'file=@document.pdf' \
-F 'remove=["javascript","attachments","metadata"]' \
-F 'validate_only=false' \
-F 'response=url'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.sanitize({
"file": 'document.pdf',
"remove": "[\"javascript\",\"attachments\",\"metadata\"]",
"validate_only": false,
"response": "url"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->sanitize([
'file' => 'document.pdf',
'remove' => '["javascript","attachments","metadata"]',
'validate_only' => false,
'response' => 'url',
]);
echo $result->requestId;More in PDFs
