Putting a headless browser behind an ASP.NET Core endpoint takes more than a NuGet package, because the browser has to be on the machine and has to start there. When a service has to render HTML to PDF in ASP.NET Core this way, the printing code is the short part, and the endpoint that returns a packing slip is only as reliable as the browser launch behind it.
PuppeteerSharp, an MIT-licensed port of Puppeteer for .NET, launches Chrome or Firefox and prints pages through PdfAsync . We look at what the packing-slip endpoint asks of the host with PuppeteerSharp and how IronPDF renders the same slip inside the endpoint.
What does a PuppeteerSharp endpoint look like?
A browser shared across requests, with a page opened per slip. Launching a browser per request is slow, so a common design launches one at startup, registers it as a singleton and opens a page for each slip.
app .…