We need to do this because when we deploy it to the Linux Consumption plan in Azure, the default download location (the app's bin folder) is readonly.Īfter the browser is downloaded, we stash the path of the executable into an AppInfo object that can be injected into our functions. Notice that on Linux, we're downloading to the machine's temp folder. When the form is submitted, the Razor renders an invoice.Įnter fullscreen mode Exit fullscreen mode Puppeteer will populate the form with some JSON data to pass to the Razor page. In the app, we'll create a form that has a single textbox. It's just a simple project created with dotnet new webapp. We'll use a typical ASP.NET Core Razor Pages app to render our invoice. Write a function that uses PuppeteerSharp to render the invoice and generate a PDF.Run the ASP.NET Core Razor Pages app in the function app. Create an Azure Functions app and configure it to run PuppeteerSharp.Build an ASP.NET Core Razor Pages app that includes a Razor template and other resources required to render the invoice.In the rest of this article, we'll walk though these steps: NET Azure Functions app and use PuppeteerSharp with headless Chromium to render the invoice Razor template to a PDF. We'll create PDF invoices for our favorite fictitious online store, Tailwind Traders. Today, we'll look at how to render PDFs in Azure Functions using Razor and the C# port of Puppeteer, PuppeteerSharp.Ī common usage of this is generating something like an invoice. A couple of weeks ago, we looked at how to use Puppeteer with Node.js Azure Functions to take screenshots of web pages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |