Compress PDF API

Compress and reduce a PDF file size by up to 90%

Sign up to convert Try for FREE

Compress PDF features

The Compress PDF API by ConvertAPI is a tool that allows for the compression and reduction of PDF file sizes by up to 90%. This API optimizes PDF quality by compressing text, graphics, images, subsetting fonts, and optimizing document structure. It offers various parameters for customization, including compression presets, color and grayscale image compression, and options to remove elements like bookmarks, annotations, forms, and embedded files from the PDF. The API also provides options for optimizing the PDF for web viewing and preserving the PDF/A standard.

API Endpoint

ConvertAPI offers a cloud-based solution, which makes Compress PDF conversion effortless with just a single REST-API call:

HTTP POST

Authenticate your API call

Converting pdf to compress via REST-API is now easier than ever. Sign up for a free account to obtain your authentication secret, append it as a query string parameter to the conversion URL, and voilĂ ! You can find advanced authentication techniques in our docs.

QUERY AUTHENTICATION

Compress PDF using REST-API in no time!

Once you have your authentication in place, you can convert your files using application/json, multipart/form-data and application/octet-stream content types. A simple HTTP POST request using JSON would look like this:

// Code snippet is using the ConvertAPI JavaScript Client: https://github.com/ConvertAPI/convertapi-js

// Code snippet is using the ConvertAPI Node.js Client: https://github.com/ConvertAPI/convertapi-nodejs

// Code snippet is using the ConvertAPI PHP Client: https://github.com/ConvertAPI/convertapi-php

// Code snippet is using the ConvertAPI Java Client: https://github.com/ConvertAPI/convertapi-java

// Code snippet is using the ConvertAPI C# Client: https://github.com/ConvertAPI/convertapi-dotnet

# Code snippet is using the ConvertAPI Ruby Client: https://github.com/ConvertAPI/convertapi-ruby

# Code snippet is using the ConvertAPI Python Client: https://github.com/ConvertAPI/convertapi-python

// Code snippet is using the ConvertAPI Go Client: https://github.com/ConvertAPI/convertapi-go

REM Code snippet is using the command line utility program: https://github.com/ConvertAPI/convertapi-cli

<!-- For conversions with the multiple file result please refer to this example: https://repl.it/@ConvertAPI/HTML-Form-with-multiple-file-result -->

Conversion request using cURL

You can easily convert pdf to compress with a simple cURL request. Our documentation provides more advanced cURL request techniques.

File conversion using CLI

ConvertAPI CLI allows you to convert files using our command-line file conversion utility tool. Check out CLI documentation for a detailed explanation and usage examples.

REM Code snippet is using the command line utility program: https://github.com/ConvertAPI/convertapi-cli

Try the conversion online - no coding required!

You can try out advanced conversion parameters and test the conversion result online using our interactive demo tool. This tool will produce the same conversion output as if you were using the library from your solution, and it will auto-generate the code snippet for you!

Try for FREE!

Conversion parameters

Preset Collection

Choose a compression level from the available presets. If a preset is selected, all other compression options will be ignored. These presets are optimized for various use cases, such as balancing file size and quality.

Values:   none text archive web ebook printer

AutoImageCompress Bool

Automatically adjust image dimensions based on the PDF's DPI and maintain 90% image quality for efficient compression.

For example, if an image has 300 DPI and the PDF has 96 DPI, the image dimensions will be reduced to comply with 96 DPI. When combined with ImageResolution, the method that results in greater compression is applied. For instance: If images originally have 300 DPI, ImageResolution is set to 150, and AutoImageCompress determines 100 DPI is optimal, the final result will dimensions reduced to comply with 100 DPI. Conversely, if ImageResolution specifies a lower value, it will take precedence.

ImageResolution Integer

Set the maximum image resolution in DPI. This setting can be combined with AutoImageCompress. In such cases, the compression will apply the lower resolution value, whether determined by the DPI setting or the AutoImageCompress property.

ImageQuality Integer

Set image quality in percentage. This setting overrides the default 90% quality value of AutoImageCompress.

RemoveForms Bool

Remove PDF forms from the PDF file.

RemoveDuplicates Bool

Remove duplicate fonts and color profiles from the PDF file.

RemovePieceInformation Bool

Remove piece information dictionaries like Adobe Illustrator or Photoshop private data.

RemoveEmbeddedFiles Bool

Remove embedded/attachments files from the PDF file.

RemoveStructureInformation Bool

Remove all structure information from the PDF document.

RemoveMetadata Bool

Detach the XMP metadata embedded in the document from its catalog, clear all properties in all schemas, and remove metadata from marked content.

RemoveUnusedResources Bool

Remove references to resources such as fonts, images, patterns.

UnembedBaseFonts Bool

Specifies whether to remove the base fonts from the PDF file.

SubsetEmbeddedFonts Bool

Output PDF should only contain font characters utilized in the original document, and any unused glyphs from all fonts in the document should be removed.

Optimize Bool

Optimize page content streams in the PDF file.

Linearize Bool

Linearize PDF file and optimize for fast Web View.

PreservePdfa Bool

Preserve the PDF/A standard in the PDF file.

Try Compress PDF for free!