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.

Web API engines work in any programming language: PHP, Javascript, C#, .NET and ASP.NET, Java, Visual Basic, and many others.

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 are encrypted during transmission. To learn more about PDF.co Security, please read this article https://pdf.co/security

SIGN UP FOR FREE

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.

Web API Supports Multiple Languages

PDF.co platform can be used by software developers from programming languages such as PHP, Javascript, .NET and ASP.NET, C#, Java, Visual Basic, and many others. Find source code samples in our API documentation.

Business Automation Platforms Integrations

If you are not a developer, you can also easily automate your PDF operations via popular business automation platforms: ZapierMakeAirtableSalesforceGoogle Apps Script, and 300+ more.

SIGN UP FOR FREE

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 source code samples 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 source code samples are available here.

The PDF Compressor API Python source code samples are available here.

The PDF Compressor API PHP source code samples are available here.

The PDF Compressor API Java source code samples are available here.

The PDF Compressor API C# source code samples are available here.

SIGN UP FOR FREE