Compress PDF using JavaScript
Compress and reduce a PDF file size by up to 90%
The Compress PDF JS module by ConvertAPI is a tool that allows for the compression and reduction of PDF file sizes by up to 90%. This JS module 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 JS module also provides options for optimizing the PDF for web viewing and preserving the PDF/A standard.
Shrink your PDFs in just a few seconds without compromising quality.
Force image recompression to ensure even pre‑compressed images get smaller.
Maintain visual quality of the original file while dramatically reducing file size.
Compression keeps text, fonts, and vector graphics sharp.
Choose from predefined compression presets or set up your own settings.
File compression is encrypted and compliant with ISO, GDPR, and HIPAA.
Easy Compress PDF integration programmatically using our simple JavaScript SDK
Install the ConvertAPI package from the npm registry: npm i convertapi-js@~1.1.
Sign up for a free account and authenticate the library using your Secret key or API token.
Set up the conversion parameters, and copy the auto-generated code snippet in your account dashboard.
Fine-tune your automation with these powerful conversion options
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.
Available values: Not set - advanced properties used Text - 20 image DPI, lowest quality, highest compression Archive - 40 image DPI, low quality, high compression Web - 75 image DPI, medium quality, high compression Ebook - 150 image DPI, high quality, medium compression Printer - 300 image DPI, high quality, low compression
Set the maximum image resolution in DPI.
Set image quality in percentage.
Remove PDF forms from the PDF file.
Remove duplicate fonts and color profiles from the PDF file.
Remove piece information dictionaries like Adobe Illustrator or Photoshop private data.
Remove embedded/attachments files from the PDF file.
Remove all structure information from the PDF document.
Detach the XMP metadata embedded in the document from its catalog, clear all properties in all schemas, and remove metadata from marked content.
Remove references to resources such as fonts, images, patterns.
Specifies whether to remove the base fonts from the PDF file.
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 page content streams in the PDF file.
Linearize PDF file and optimize for fast Web View.
Preserve the PDF/A standard in the PDF file.
Our user-friendly interactive demo enables you to easily set up and test the conversion from your account dashboard with just a few simple clicks.
Upload your PDF document that you wish to convert, and set up any additional conversion parameters using our intuitive and user-friendly interface. You can fine-tune and adjust the conversion parameters to suit your needs with no technical knowledge required.
Get Started for FreeWhen you have your conversion parameters set up, you can run the conversion and download the converted document to evaluate the Compress PDF conversion quality. You can further adjust the parameters if needed, until you are satisfied with the result.
Get Started for FreeOnce you are happy with the conversion result, you can copy the auto-generated code snippet to your project and use it to perform the conversion programmatically. This will save you time and effort, and you will be able to focus on your project development.
Get Started for FreeHighest rated File Conversion API on major B2B software listing platforms: Capterra, G2, and Trustpilot.
"ConvertAPI has been a game-changer for our document automation workflows. Their conversion accuracy and API reliability are unmatched in the industry for over 7 years."
"ConvertAPI is a reliable, cost-effective solution with a proven track record of stability. It has grown significantly in maturity, adopting enterprise-grade practices over the years."
"We've integrated ConvertAPI across our entire document processing platform. The performance is exceptional and the support team is always responsive. Highly recommended!"
We ensure that all document processing is handled securely in the cloud, adhering to industry-leading standards like ISO 27001, GDPR, and HIPAA. To enhance security even further, we can ensure that no files or data are stored on our servers and never leave your country.
Learn more about security