Forum Discussion
PDF generation in Azure App Service
I'm looking for a solid option for PDF generation that is compatible with running within the constraints of Azure App Service or Azure Functions. I know of several options but am curious what others are using and having solid reliable success with?
4 Replies
For reliable PDF generation on Azure, I would choose the hosting model based on what the PDF library needs.
If the library depends on a browser engine or native OS packages, the most reliable pattern is usually a Linux custom container running on App Service, Azure Container Apps, or Functions Premium/custom container. That lets you install Chromium/wkhtmltopdf/native dependencies in the image and test the exact runtime.
A few practical recommendations:
- Avoid libraries that depend on Windows desktop/GDI-style APIs in the App Service sandbox.
- For HTML-to-PDF, headless Chromium through Playwright/Puppeteer can work well, but package it in a Linux container with all dependencies installed.
- For Azure Functions, avoid Consumption plan for heavy PDF rendering. Premium or Dedicated is usually safer because of timeout, memory, cold start, and native dependency concerns.
- Put PDF jobs behind a queue if generation can take time, and write output to Blob Storage rather than relying on local disk.
- If PDF fidelity is business-critical, consider a managed PDF service/API to avoid maintaining browser/runtime dependencies yourself.
So my default choice today would be a containerized worker or App Service Linux container for predictable dependencies, not plain Functions Consumption.
Docs:
https://learn.microsoft.com/azure/app-service/configure-custom-container
https://learn.microsoft.com/azure/azure-functions/functions-scale- ElenaMiaTin Contributor
We've worked on several cloud-native document generation projects at Damco Solutions, and for Azure App Service and Azure Functions environments, reliability and scalability are usually the key considerations. We've had good success with libraries such as QuestPDF and IronPDF for .NET-based applications, depending on the complexity of the PDF output and formatting requirements.
For high-volume enterprise workloads, it's also worth considering a microservices-based approach where PDF generation is handled separately and triggered through Azure Functions. This helps improve performance and makes scaling easier during peak demand. The best choice often depends on whether you need simple reports, complex layouts, dynamic templates, or compliance-driven document generation.
I'd be interested to know what your primary use case is—reports, invoices, contracts, or something else—as that can significantly influence the recommended solution.
https://www.damcogroup.com/azure-cloud-services/azure-migration
- jeflexCopper Contributor
Try https://alfareport.com – command-line tool for generating PDF documents from JavaScript scripts. No runtime, no frameworks, no dependencies — just a single binary.
- Frank Migacz
Microsoft
Just now seeing this! The problem is the deep OS-dependencies that PDF generation requires, and which is unavailable in the App Service sandbox. See this description is the Kudu service wiki: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox
But if you have HTML source, here is a blog article that considers several options and lands on one: https://whuysentruit.medium.com/generate-html-based-pdf-reports-from-azure-app-service-a2c63838abb3