Let the tmpdir be injectable.

I have a situation where I need a precise directory to be use for tmpdir. I just made it optionally injectable in `Document`