I have got two pdf files with same number of pages and want compare each page with the corresponding page in the other file. For this I would like to merge say page 1 of File1.pdf with page 1 of File2.pdf so it gets one page in the new document. Then page 2 of File1.pdf with page 2 of File2.pdf and make it page 2 of the new file.
In this question I learned already that I can put two pages on one page with the --nup
option of the pdfjam
command:
pdfjam File1.pdf File2.pdf --nup 2x1 --landscape --outfile File1+2.pdf
The same can be achieved with the ImageMagick
package:
montage *.pdf merged.pdf
But this puts together page 1 and page 2 of the first file and does the same later on with the second file - not as intended.
What I did is to split the two documents. The first file got even numbers in the file name, the second odd numbers (actually I created the files anew with appropriate file names). Then I merged all files again with
pdftk *.pdf cat output merged.pdf
and finally put two pages on one with
pdfjam --nup 2x1 --landscape --outfile merged2up.pdf merged.pdf
I could write a script with a loop doing this, but I was wondering whether there is an easy one-liner to achieve this? Maybe I didn't find the right pdfjam, pdftk or ImageMagick command?
pdftk
has a "shuffle" option, which looks like it would allow you to merge the two documents with alternating pages without needing to first split them to individual pages. At that point, many PDF viewers have an option to show two pages at once side by side, so you might not even need the "N up" operation at that point.