Merge content of several pdf documents

I get lot’s of stamp-documents like this every day:

stamp-doc

There is lot’s of white space under every stamp. If I print them, that cost’s lots of paper, so I want to merge the content of several documents into one pdf-document. So that I can place like 8 stamps on into one document and just have to print one page instead of 8.

I want to solve this problem with javascript (or node.js) and I’ve already found some pdf-libraries, but these libraries just let me copy whole pages and don’t eliminate the white-space.

Are there any suggestions?

I also thought about converting the pdf to png or jpeg and cut the whitespace of the image, but I don’t if that’s possible.

I would really appreciate your help πŸ™‚