Azure App Service isn't the local IIS environment you have, so you cannot expect the same code to work everywhere. Either you switch to your own Azure VM to host this web app, or you use a library that is compatible with Azure App Service (an open source project like QuestPDF is unlikely). You can ask the vendor of QuestPDF for more assistance, https://github.com/QuestPDF/QuestPDF/issues
PDF won't Generate in Azure Website
I just deployed my first website in Azure. In that website, there is a button to generate a PDF file dynamically using QuestPDF. When my app runs locally, the PDF is correctly generated creating the file under the main project folder. However, after deploying the website and running it on the server (azurewebsites.net), I get an error in a popup window saying "Failed to receive the data". Using the developer tools (F12 in Chrome) in the Console tab I get a 500 internal server error. It seems to me that it has to do with the privileges/permissions on creating/writing a new file in the published project.
I will appreciate your feedback.
Sign in to comment
Sort by: Most helpful
Adding to lextm's pointers.
All Azure Web Apps (as well as Mobile App/Services, WebJobs and Functions) run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available.
Many Windows/.NET specific versions leverage IE APIs and therefore leverage User32/GDI32 extensively. These APIs are largely blocked in the sandbox (regardless of plan) and therefore these frameworks do not work in the sandbox.
Kindly see the supported and unsupported PDF generators on sandbox - Azure Web App sandbox
Also, checkout the discussion thread -How can I enable wkhtmltopdf in Azure Windows App.
We found the problem. The issue was with an image in the wrong location. Such image has to be part of the PDF file.
QuestPDF is fully compatible with Azure.
Thanks for the follow-up. Glad to know that the issue is sorted out.
Much appreciate you sharing the solution that worked for you with the community.
Sign in to comment