Html To Pdf with .NET Core and Azure Functions

SelectPdf and Azure FunctionsAzure Functions allows you to run small pieces of code (called “functions”) without worrying about application infrastructure. With Azure Functions, the cloud infrastructure provides all the up-to-date servers you need to keep your application running at scale.

SelectPdf offered a .NET Core version for some time, but although it worked on some types of Azure deployments, it was not supported on Azure functions, due to some platform restrictions.

Things have changed starting with Azure Functions V3 and SelectPdf Library can run in an Azure Function. There are a few other things to take into account: similar to Azure Web Apps deployments, SelectPdf will use a restricted rendering engine to be able to run in an Azure Function. The hosting plan should be Premium or App Service Plan, starting with Standard. SelectPdf will not work with an Azure Consumption Plan nor with a Free or Shared App Service Plan.

SelectPdf and Azure Functions Sample

The following sample was created in Visual Studio 2019 and uses Azure Functions V3 with .NET Core 3.1. It shows how to read several parameters received through a GET or POST request (x-www-form-urlencoded or json encoded) and how to convert to pdf the specified url or html string.

For more details about our html to pdf converter or any other feature related to our pdf library for .NET, do not hesitate to contact us.