title: Merge pdfs in a grid
body: <p>I have hundreds of pdf files representing cards for a card game. They are standard 2.5"x3.5" files build using LaTeX. In order to print them I want to concatenate them together into a single pdf with 9 cards per page (the most that can fit). Currently I do this using <code>montage -density 300 -tile 3x3 -geometry 750x1050+50+25 a.pdf b.pdf ...</code> </p>
  
  <p>Unfortunately there are a few problems with this solution:</p>
  
  <ul>
  <li><p>Loss of detail -- The <code>-density</code> option is necessary to get decent quality, and the result becomes dependent on desired quality. My printer can print at 600dpi, so I should use <code>-density 600</code>, but some printers won't handle that correctly.</p></li>
  <li><p>Slow -- The other reason I don't use 600 is that even at 300 imagemagick is extremely slow because I think it is converting the pdfs to images, then concatenating them into a pdf. </p></li>
  <li><p>Limited -- Additionally when the number of input files grows sufficiently large, montage will just crash without being able to create the resulting pdf.</p></li>
  <li><p>Loss of perks -- Finally, the resulting pdf doesn't keep the metadata of the originals. Most importantly the text is no longer selectable. This means that I can't search the pdf for a specific card.</p></li>
  </ul>
  
  <p>In order to fix this I am currently using pdfunite to make a long pdf with 1 card per page, then telling my printer to print 9 on each page. The result is fairly close to the desired effect, however the sizes of the cards are slightly distorted, which is a bit of a problem.</p>
  
  <p>Is there any way to concatenate pdfs in a grid with specific sizes?</p>