Merge PDFs

Join several PDFs easily using the Visual PDF REST API.

Basic PDF merging

To use the PDF merging tool, you will need to use a merge task in a file processing pipeline.

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

      // Adding 2 files to the pipeline
      form.append('file-1', myFirstFile);
      form.append('file-2', mySecondFile);

      // Merging these files
      form.append('tasks', [{ tool: 'merge' }]);
    
  

Custom merge order

By default, files are merged in the order they were added to the pipeline.

However, you can define a personalized order using the order option, by giving the files indexes in the order of your choice.

    
      form.append(
        'tasks',
        [
          {
            tool: 'merge',
            // Put the second file first
            options: { order: [1, 0] },
          },
        ],
      );