Compress PDF using NodeJS
Compress and reduce a PDF file size by up to 90%
Try it Free SDK libraryThe Compress PDF NodeJS package by ConvertAPI is a tool that allows for the compression and reduction of PDF file sizes by up to 90%. This NodeJS package 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 NodeJS package also provides options for optimizing the PDF for web viewing and preserving the PDF/A standard.
ConvertAPI provides a Node.js library that allows you to perform a Compress PDF conversion with just a few lines of code.
First, install our convertapi
library from npm:
npm install convertapi --save
You can obtain your secret key by signing up for a free account. Once you sign up, you'll receive 250 free conversions instantly! Grab your authentication secret from the account dashboard, and authenticate the ConvertAPI Node.js library like this:
var convertapi = require('convertapi')('secret_or_token');
const convertapi = new ConvertAPI('secret_or_token');
Once you have your authentication in place, simply copy-paste this pdf to compress conversion code snippet into your Node.js project:
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!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
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.
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