1

I would like to find the best (most efficient and most reliable) solution to do the following:

  • I have one big PDF page A (let's say with 1000 pages)
  • I have another PDF page B (smaller, let's say 2 pages)
  • I want to merge PDF B into PDF A after every n-th (let's say after every second) page of A

Is there a Linux tool which supports this in a easy to use param syntax (like giving a param '-merge-after-every 2')?
Maybe other alternative solutions/approaches?

I tried pdfsam, but it seems that you need to pass in a very long param list with the explicit page sequence. Also, pdfsam dies with a stackoverflow exception on my machine when you want to merge a PDF page after every page of 1000 pages PDF (it works for smaller page sizes of file A).

spaudanjo
  • 764
  • 7
  • 13
  • 1
    I think whatever answer there is for [your previous question](http://stackoverflow.com/q/24699773/472495) it will apply to this one as well. There seems to be something in the Linux world called `pdfmerge`, so I'd extract pages and merge them, but I'd expect to use a loop of some kind. Rather than doing this in one command (which as you say is not stable for you), a merge program should just append an extracted page to the current PDF - just do that every n pages until there are none left. – halfer Jul 14 '14 at 18:26
  • (Btw, for both questions, they might conceivably be put on hold as recommendation questions. It might be better for questions of this kind to be phrased as 'here is my code to do X, can I do it in one command without a loop' or similar). – halfer Jul 14 '14 at 18:28

0 Answers0