From the course: Extend Web Application Functionality on Microsoft Azure

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Implementing the code to generate a PDF file using Puppeteer

Implementing the code to generate a PDF file using Puppeteer - Azure Tutorial

From the course: Extend Web Application Functionality on Microsoft Azure

Implementing the code to generate a PDF file using Puppeteer

- [Instructor] Okay, so now we need to implement the code for generating the PDF files, and for that we're going to use Puppeteer. That's why we added PuppeteerSharp which is the .net implementation of Puppeteer. Okay, so let's go ahead and create the following method, private static. For here, I want to return a stream. So I want to do that asynchronously. And let's name this ConvertHTMLtoPDFAsync. So we're going to take the HTML content for that. Okay, so now the first thing that we need to do is download Chromium. The thing about Puppeteer is that it uses Chromium, but it needs to download the executable of Chromium. So that's why that's the first step. We need to create a new browser fetcher object. So browser fetcher equals new browser fetcher. And this is going to take a browser fetcher option. So let's do that. Browser fetcher options equals browser fetcher options. And specifically I want to set the path,…

Contents