The same error has already happened to me. To generate a PDF on a deployed app, you need to do some different configurations that depend on where your app is running.
Follow this documentation, and you will be able to fix this error.
https://docs.mendix.com/appstore/modules/document-generation/#configuration