Skip to main content
DocsAPI ReferenceCompress PDF

Compress PDF

Reduced the file size of a PDF document while preserving quality.

Endpoint

Post/api/v1/compress

Parameters

NameTypeDescription
file*fileThe PDF file to compress.
qualitystringCompression level: low, medium, high. Default is medium.

Implementation Example

Use our standard multipart/form-data interface to process files. Ensure you include yourx-api-key in the request headers.

compress.js
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('quality', 'high');

const response = await fetch('https://api.pdftheory.com/v1/compress', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY'
  },
  body: formData
});

const result = await response.blob();

Important Notice

Maximum file size is currently 50MB. If you need to process larger files, please contact our enterprise sales team.

pdftheory - プロフェッショナルPDFツール | PDFTheory