Unable to download Visualforce page

Issue

You run a DocGen Package and see this message:

Unable to download Visualforce page {(!string.IsNullOrWhiteSpace(ex.Message) ? $": {ex.Message}" : ". ")} (ResourceInvalid)

Cause

You could get this message if you're trying to render a PDF from a Visualforce page and the Visualforce page contains an error (possibly in the Apex controller or extension) or the Visualforce page is using components not designed for rendering PDFs.

Resolution

You must troubleshoot the Visualforce page. For more information, start with these topics in the Salesforce documentation.