I have two pdf or postscript files (I can work with either one). What I want to do is merge each page on top of the other so that page1 of document A will be combined with
PDFbox for Java supports a Overlay class which allows to merge PDFs this way. See this answer: Watermarking with PDFBox
However, both PyPDF2 and PDFbox have been unreliable in my experience, but perhaps this is helpful for someone.