The PDF Compressor API optimizes a PDF document to reduce its size. This PDF optimization is ideal when you are constrained by file size limitations without losing much on file quality.

The PDF Compressor API can optimize PDF files of any size. It works perfectly well with documents that contain images and text.

All the documents that pass through the Web API are encrypted during transmission. To learn more about PDF.co Security, please read this article https://pdf.co/security

PDF Compressor API Benefits

Reduce Large Files

The Web API can automatically reduce a PDF file size. When working with large files, it is always considered a best practice to use async:true to avoid job interruption.

Maintain File Quality

The Web API can reduce a PDF file size without sacrificing the quality. Maintaining the balance between smaller file sizes and good quality is our highest priority. The PDF output of our PDF Compressor API works well with our other APIs.

On-Premise API Server

We build APIs for businesses and enterprises. We understand that some documents have sensitive information and need to remain confidential. We have an on-premise API Server option that is customizable for specific APIs. To get a trial, please send a request to our support team.

Sign Up

PDF Compressor API Integrations

PDF.co has over 300+ app integration. Kindly explore our following plugins:

PDF Compressor API Samples & Demo

In this demonstration, we will use a 5-page PDF document that contains text in images. We will reduce its size using the /v1/pdf/optimize endpoint. We have a side by side graphics of the original and compressed files as well as their corresponding sizes below:

PDF Input And Output Of The Compressor API
Images of Original and Compressed PDF Files

Let’s review the /v1/pdf/optimize endpoint’s parameters and their corresponding functions.

Endpoint

URL: https://api.pdf.co/v1/pdf/optimize
Method: POST
Parameter Description
url required. Link to the source file.
name optional. Filename of the generated output.
encrypt optional. Enable encryption to output file.
async optional. Runs processing asynchronously. Returns jobId to use with job/check: true or false
name optional. Output file name.
profiles optional. Must be a String. Set custom configuration. See profiles examples here

 

cURL Code Snippet

curl --location --request POST 'https://api.pdf.co/v1/pdf/optimize' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-optimize/sample.pdf",
    "name": "result.pdf"
}'

The PDF Compressor API is also known as Optimization API other cURL sample codes are available here.

Let’s see the PDF Compressor API in action using the cURL code above.

PDF.co PDF Compressor API Output PDF

The PDF Compressor API JavaScript sample codes are available here.

The PDF Compressor API Python sample codes are available here.

The PDF Compressor API PHP sample codes are available here.

The PDF Compressor API Java sample codes are available here.

The PDF Compressor API C# sample codes are available here.

Sign Up

Related Samples: