added direct download in pdf function