I have used VBA to combine multiple PDFs to a single PDF. This is a rather common topic. Google "VBA merge PDF". I don't know if 'marginalization' can be programmatically managed. What should happen if some documents are in landscape orientation?
I know nothing about converting JPG to PDF.