make document URL accessible for the generator
add document directory to TEXINPUTS

If the document contains inclusions of resources, that use relative path,
this is needed for the compilation from a temporary dir

This makes \pgfimage with related path work