title: Merge two PDF files -- one as background, one as foreground
body: <p>I have two PDF-files. Both have the same geometry and the same amount of pages. I would like to merge them, such that one file is the background and one file is the foreground. I tried pdftk with the background option:</p>
  
  <pre><code>pdftk bg.pdf background fg.pdf output out.pdf
  </code></pre>
  
  <p>But pdftk just uses the first page of the bg.pdf as a watermark for all pages. I would like to do it in Java (for example with the iText library) or with a bash command. Any suggestions?</p>