How to include PDF Viewer in WPF Application

Vishal2 Bansal 145 Reputation points
2024-08-16T10:51:35.4633333+00:00

Hi

I have to include the pdf viewer in my wpf application.

  1. It should have ability to navigate to other pages of pdf.
  2. It should should pdf in fullscreen mode.

Currently i found no support in wpf . Please help in this case.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,921 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,012 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 66,706 Reputation points
    2024-08-16T15:48:50.1766667+00:00

    There is no builtin support. You will need a third party library. Google for options.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Castorix3193 40 Reputation points
    2024-08-17T10:48:57.7866667+00:00

    You can use Windows.Data.Pdf

    (I posted samples in C#/WPF with my main account, which seems to have problems...)


  2. Hongrui Yu-MSFT 2,465 Reputation points Microsoft Vendor
    2024-08-19T07:20:59.98+00:00

    Hi,@Vishal2 Bansal. Welcome to Microsoft Q&A. 

    Set the WPF program to borderless full screen, then use WebBrowser to load the PDF, and finally set the PDF reader to a reader with navigation function.

    Set the Wpf program to borderless full screen.

    
        public partial class MainWindow : Window
    
        {
    
            public MainWindow()
    
            {
    
                InitializeComponent();
    
                this.WindowStyle = WindowStyle.None;
    
                this.WindowState = WindowState.Maximized;
    
                this.ResizeMode = ResizeMode.NoResize;
    
            }      
    
        }
    
    

    Loading Pdf using WebBrowser.

    
    <WebBrowser x:Name="MyBrowser" ></WebBrowser>
    
    
    
    string url = "The path to your PDF";  
    
    MyBrowser.Navigate(url);
    
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.