I have about 80 PDF pages, all of which have width of 8.27 inches ( A4 width), but the height varies - e.g. some are 4" tall, others are 2.5" tall - there is no standard height. Let me call them snippets. I am looking to combine them so that they can fit into A4 size pages.
I have come across some utilities like nup or pdfnup but these all assume that the pages to be combined are of identical size ( say A5, to be combined into A4) . I don't care about the order of the pages, but I need to make sure that these snippets don't get cut off (or spill over into the next page) when combined. Think of it like how one would handle pasting snippets in a scapbook. If a snippet fits into a A4 page, I add to the page (no rotation etc). If some space gets left on the page, I can add another snippet that can fit in the space available. If not, I can use another page. However, the snippet must not get cut or spillover to another page.
I doubt if there is any utility/command that can do it automatically. I can work by adding snippets manually one by one - I am just looking for a suggestion on how to do it, or just help me get started.

pdfpages? – remco Mar 30 '18 at 05:17