Free plan

Interleave scans

Weave two scans into one PDF, front and back pages in order
POST
/v1/pdfs/interleave

About this tool

This tool mixes the pages of two PDFs into one, taking turns: page 1 of the first file, page 1 of the second, page 2 of the first, and so on. It is made for double-sided paper scanned by a one-sided feeder, where fronts and backs ended up in two files. If the backs were scanned from the last sheet to the first, you can tell it to read that file in reverse.
For example, you scanned the fronts of a 10-sheet contract, flipped the pile, scanned the backs, and now want one PDF with all 20 pages in reading order.

How to use it

  1. Choose this tool.
  2. Add the first PDF (the front sides) and the second PDF (the back sides). It needs exactly two files.
  3. Turn on the option to reverse the second file if the backs were scanned from the last sheet to the first.
  4. If needed, choose which file starts, how many pages to take at a time, and what to do when one file has extra pages.
  5. Press Generate, then download the new PDF.

What you get back

You get one new PDF with the pages of both files woven together in order. Your original files are not changed, and you can download the result.
GOOD TO KNOW
Both files must be readable PDFs (not protected). Counts as two PDF files and one operation.
TEST IT LIVE

Try Interleave scans in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/interleave
Tool ID
pdfs.interleave
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/interleave" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'other=@document.pdf' \
  -F 'step=1' \
  -F 'start_with=first' \
  -F 'leftover=keep'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.interleave({
    "file": 'document.pdf',
    "other": 'document.pdf',
    "step": 1,
    "start_with": "first",
    "leftover": "keep"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->interleave([
    'file' => 'document.pdf',
    'other' => 'document.pdf',
    'step' => 1,
    'start_with' => 'first',
    'leftover' => 'keep',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Weave two PDFs into one: the front sides and the back sides of a double-sided stack scanned by a one-sided feeder (front 1, back 1, front 2, back 2 …), with the backs reversed when they were scanned from the last sheet to the first.

Interleave scans accepts PDF. Send one file per request.

Interleave scans is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/interleave with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.