I'm not aware of a way to do this while keeping the images in a vector format. However, as you are already using GIMP, and thus converting to bitmap, I assume you don't mind that too much. If so, the process can be automated using some command line tools. Here is a bash script that does this:
# input files expected in pdf, output in png
# generate png file names
# first, convert both pdf files to png. The best tool for this
# is pdftoppm from popplerutils. We switch off antialasing
# of fonts (-aa no) and other elements (--aaVector no) in
# order to avoid ghosting at the edges. The -r option sets the
# resolution (pixels in the output image per inch of input image).
# Use a high enough resolution, you can always reduce image size
# (and maybe apply antialising) later.
pdftoppm -r 300 -png -aa no -aaVector no $bg_pdf > $bg_png
pdftoppm -r 300 -png -aa no -aaVector no $fg_pdf > $fg_png
# now, we use imagemagick's convert to convert white to transparency in the
# foreground image
convert $fg_png -transparent white $fg_png
# finally, we use imagemagick's composite to stack them on top of each other.
# the -gravity center option centers the images to each other; it is not
# needed if they are of equal size.
composite -gravity center $fg_png $bg_png $output_png
# you could also use convert to reduce size and apply antialias
# convert $output_png -antialias -resize 50% halfsize.png
Save this as
script.sh and make executable (
chmod +x script.sh). Call this like
./script.sh background.pdf foreground.pdf composite.png
A breathtakingly beautiful example (input files uploaded as PNG, but I tested at home on the PDF originals):