Extract only the odd-numbered pages from a PDF document.
When a human looks at a book, the very first page is Page 1. But in computer science, arrays are almost always zero-indexed.
This means the first page is located at index 0, the second page (Page 2) is at index 1, and the third page (Page 3) is at index 2.
To extract "Odd Pages" (Page 1, 3, 5, 7...), the algorithm must iterate over the PDF's internal /Kids array and select the pages located at even indices (index 0, 2, 4, 6...).
The mathematical logic uses the modulo operator (%), which returns the remainder of division. We filter the array for indices where index % 2 === 0.
This tool is primarily used for reconstructing physical documents scanned by older, single-sided (simplex) scanners.
If you have a stack of double-sided papers, you scan all the fronts (Odd pages) into one PDF, flip the physical stack over, and scan all the backs (Even pages) into another PDF. You can then use this tool in combination with our Merge/Reorder tools to interleave them back into a perfect digital replica of the physical book.
In a zero-indexed array, what is the index of Page 5?