The problem is likely your CGRect
. Assuming that your x and y margins are OK, you probably have an image that is too large to fit on the page as measured from these margins.
You need to determine how far you can draw to the right and bottom and scale the image accordingly. (e.g. as described here)