fix/invert logic around PDF paths
fix permissions on generated files