This is a simple Azure Function that converts posted HTML to a PDF file. It uses PuppeteerSharp to launch a headless browser and render the HTML to a PDF file. This project is configured to work on a Linux Consumption Plan.
Install the Azure Functions Core Tools and run the following command from the project's root directory:
func azure functionapp publish <functionappname> --dotnet-isolated
To use this function, post HTML to the function URL. The function will return a PDF file.
Here's an example using curl
:
curl -X POST -H "Content-Type: text/html" -d "<h1>Hello world!</h1><p>This PDF was rendered with Chromium!</p>" <function-url> -o output.pdf