You can use ImageMagick for this. It has an overwhelming amount of options, but if you dive into it you'll see that it's easy to pick up. Check an overview of all commandline options here. For your question, I used the following options:
- -compress jpeg: to convert the pdf fragments to jpeg before putting them in the new document. I think you can also leave this option out, which will leave the pdf's as pdf inside the new document (not tested).
- -extent: to make the pages A4 size at 150 dpi. Check the dimensions you need for your paper size and resolution. A4 at 150 dpi results in 1240x1753 pixels.
- -resize: to resize the images/pdf's to fit the bounds of A4 size at 150 dpi. You can leave this out if you don't want the original pdf's resized. Use the same geometry as with -extent.
- -gravity: with tells you where on the page your image is placed. NorthWest is the top-left corner.
- -units and -density: to set the dip (in this case I chose 150 dpi)
Note that the order of operations is relevant (executed in order). So the -gravity needs to be placed before the extend. Or, as said in the manual:
If a -gravity setting occurs before another option or setting having a geometry argument that specifies an offset, the offset is usually applied to the point within the image suggested by the -gravity argument.
So my entire command was: convert *.pdf -compress jpeg -resize 1240x1753 -gravity NorthWest -extent 1240x1753 -units PixelsPerInch -density 150x150 output.pdf