API Reference and Developer Documentation
PDF Compression⚓
For quick API reference and testing, you can find our OpenAPI docs page at the following link
https://api.kraken.io/v1/docs
https://api.kraken.io/v1/docs
Our PDF compression API optimizes and reduces the size of PDF files. The API provides flexible options to tailor compression to your needs while attempting to maintain a balance between file size and quality.
Understanding Lossless and Lossy Modes⚓
Kraken API automatically determines the optimal compression settings based on the content type of the PDF (e.g., image-heavy, text-heavy, or mixed content). Additionally, users can optionally provide custom parameters to further control the compression process.
Lossless compression is not fully applicable for PDF files, as reducing file size without any quality loss, especially for image-heavy content, is currently not feasible. As such, regardless of whether you set
lossy
to true
or false
, the API will operate in lossy mode.Optional Parameters for Custom Compression⚓
level | Optimization level for the PDF. Overrides DPI values. Available options:
|
quality | JPEG quality for embedded images. Acceptable values: 1-100. Higher values preserve more detail but increase file size. Default is 65. |
dpi | Resolution for images within the PDF. Default value is calculated based on the PDF type. Adjust this value based on your desired output quality. |
downsampleType | Method used to downsample images:
|
Example Usage⚓
- JSON
- PHP
- Node
- Ruby
- Python