pdf generator query problem