PDF capture fix.

This hopefully addresses #547.