Have you read the page about recording PDF?
Can you show your code? Or, if too complex, a simple one reproducing what you do.
Can you show your code? Or, if too complex, a simple one reproducing what you do.