---
title: "How to print PDF files via Microsoft Edge in C#?"  
description: "How to print PDF files via Microsoft Edge in C#?"  
author: "Revati S Misra"  
published: 2023-09-25  
updated: 2023-09-27  
canonical: https://www.mindstick.com/forum/159907/how-to-print-pdf-files-via-microsoft-edge-in-c-sharp  
category: "c#"  
tags: ["c#", "pdf"]  
reading_time: 2 minutes  

---

# How to print PDF files via Microsoft Edge in C#?

How to [print](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) [PDF files](https://answers.mindstick.com/qa/94935/why-does-chrome-on-android-not-open-pdf-files-like-chrome-on-windows-linux-can) via [Microsoft Edge](https://www.mindstick.com/news/1745/editing-images-before-saving-them-will-become-easier-with-microsoft-edge) in C#?

## Replies

### Reply by Aryan Kumar

As of my last knowledge update in September 2021, [Microsoft](https://www.mindstick.com/articles/12301/microsoft-is-trying-to-kill-passwords) [Edge](https://yourviews.mindstick.com/view/85544/beyond-locks-and-passcodes-the-cutting-edge-of-mobile-data-security) did not provide a direct API for programmatically printing [PDF](https://www.mindstick.com/articles/311856/6-of-the-best-pdf-editors-to-meet-your-business-needs) [files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud) from a C# application. However, you could use a workaround by launching Microsoft Edge with the PDF file's URL and then letting the user interact with the browser to print the PDF manually. Here's how you can do it:

```plaintext
using System.Diagnostics;

public void PrintPDFViaEdge(string pdfUrl)
{
    try
    {
        // Create a ProcessStartInfo with the URL to the PDF file
        ProcessStartInfo psi = new ProcessStartInfo
        {
            FileName = "msedge.exe", // Use the path to msedge.exe if not in system PATH
            Arguments = pdfUrl
        };

        // Start Microsoft Edge with the PDF URL
        Process.Start(psi);
    }
    catch (Exception ex)
    {
        // Handle any exceptions (e.g., if Microsoft Edge is not installed)
        Console.WriteLine("Error: " + ex.Message);
    }
}
```

In this code:

- **ProcessStartInfo** is used to specify the application to be launched (Microsoft Edge) and the URL of the PDF file you want to open for printing.
- **Process.Start(psi)** is used to start Microsoft Edge with the specified URL.

Please note that this approach relies on the user manually interacting with Microsoft Edge to print the PDF. There is no direct programmatic way to trigger printing from C# code using Microsoft Edge's API.

Additionally, the availability and behavior of this method might change with updates to Microsoft Edge. Always check the latest documentation and APIs provided by Microsoft if you need more advanced control over printing PDFs from your C# application.


---

Original Source: https://www.mindstick.com/forum/159907/how-to-print-pdf-files-via-microsoft-edge-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
