Compress PDF

Compressing a PDF allows you to reduce its size. Find out how to compress PDF easily from the Visual PDF REST API.

Basic page cropping

The PDF compression tool can be used in a pipeline via a compress task.

    
      // Creating the form data for the pipeline
      const form = new FormData();

      form.append('tasks', [{ tool: 'compress' }]);
    
  

Compression level

You can choose between 3 compression levels, to best adapt the compression to your needs.

  • low: the PDF quality is remained
  • medium: images in the PDF may lose slightly quality. This is the default level
  • high: images in the PDF can lose a lot of quality
    
      form.append(
        'tasks',
        [
          {
            tool: 'compress',
            // Compress input files as much as possible
            options: { level: 'high' },
          },
        ],
      );