Posted by a ceTe Software moderator
By design, the only reason that this exception is ever through is if a Document containing no Pages is attempted to be drawn (using the Draw or DrawToWeb method). A Document with no Pages is not a valid Document and will always throw this error.
The logic within your application must be allowing for the creation of Document that is not having any pages to it. You may consider either modifying your logic to prevent this case from ever happening or doing a check on the Document object before you draw it to verify the Document has pages.
Thanks,
ceTe Software Support Team