Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So, if I rightly understand, you have two pdf files</p> <ul> <li>odd.pdf</li> <li>even.pdf</li> </ul> <p>and you need to INTERLEAVE these pages from these two multipage pdf files: (odd, even, odd... and so on...)</p> <p>I wrote some time ago, for same needs, a script I attach, it is INTERACTIVE, meaning it asks for arguments, if you prefer a NON INTERACTIVE SCRIPT, I can modify it</p> <p>it only needs <strong>PDFTK</strong></p> <pre class="lang-sh prettyprint-override"><code>#!/bin/bash #script able to interleave the pages of two pdf files, saving the result in a new pdf file. Useful for any use, specially to mount parallel text books echo "enter the name (with extension) of first PDF" read filename1 echo "enter the name (with extension) of second PDF" read filename2 pages1="`pdftk $filename1 dump_data output |grep Pages|cut -f2 -d :`" pages2="`pdftk $filename2 dump_data output |grep Pages|cut -f2 -d :`" if [ $pages1 -gt $pages2 ] then pagesincr="$(echo "scale=0; $pages2+1" |bc -l)" echo "$filename1 has $pages1 pages" echo "$filename2 has $pages2 pages" rule="$(for x in $(seq 1 $pages2); do echo -n "A$x B$x "; done; for x in $(seq $pagesincr $pages1); do echo -n "A$x ";done)" echo $rule elif [ $pages2 -gt $pages1 ] then pagesincr="$(echo "scale=0; $pages1+1" |bc -l)" echo "$filename1 has $pages1 pages" echo "$filename2 has $pages2 pages" rule="$(for x in $(seq 1 $pages1); do echo -n "A$x B$x "; done; for x in $(seq $pagesincr $pages2); do echo -n "B$x ";done)" echo $rule else echo "$filename1 has $pages1 pages" echo "$filename2 has $pages2 pages" rule="$(for ((a=1, b=1; a &lt;= $pages1, b &lt;= $pages2 ; a++, b++)); do echo -n "A$a B$b "; done)" echo $rule fi pdftk A=$filename1 B=$filename2 cat $rule output interleaved.pdf echo "file created!" exit 0 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload