Printing PDF’s in Blazor

The final result

Exploring the alternatives

PrintJS as baseline

Getting started

Install-Package Append.Blazor.Printing
//using Append.Blazor.Printingbuilder.Services.AddScoped<IPrintingService, PrintingService>();
@using Append.Blazor.Printing
@inject IPrintingService PrintingService
<button @onclick="@(()=> PrintingService.Print("docs/sample.pdf"))">
Print PDF
</button>
public IActionResult Get()
{
var stream = new FileStream(@"path\to\file", FileMode.Open);
return File(stream, "application/pdf", "FileDownloadName.pdf");
}

Caveats

GitHub

Going further

--

--

--

Turning coffee into code.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top 30+ DevOps Interview Questions | Ultimate list for 2020

How to use Github as a free web hosting for your website

Setting goals for my first year as a software engineer

THE CONCEPT OF VERSE10 ROADMAP EXPLAINED

Test Case: A description of its concept

How to handle My Lunch and Manager in Lunch Module Odoo V15

OCRguessr: making posters into a guessing game

A screenshot show a game in progress. On the left is a poster advertising the Mass Radiography Unit with some letters covered by grey rectangles. On the right there is information about the game in progress: Incorrect guesses remaining, unique characters left to guess, and letters already guessed.

Calculating the Error on JupyterLab

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Benjamin Vertonghen

Benjamin Vertonghen

Turning coffee into code.

More from Medium

C# Card Deck

C#, VB.NET Replace Bookmarks in Word

The AJut libraries are open source, and out of alpha!

Visual Studio 2022 Browser Edge with Your Profile