https://github.com/welterdevelopment/pdfjs.winui
PDFjs wrapper for WinUI 3
https://github.com/welterdevelopment/pdfjs.winui
Last synced: 10 months ago
JSON representation
PDFjs wrapper for WinUI 3
- Host: GitHub
- URL: https://github.com/welterdevelopment/pdfjs.winui
- Owner: WelterDevelopment
- Created: 2022-01-05T11:44:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-19T17:59:51.000Z (over 1 year ago)
- Last Synced: 2025-01-16T22:37:58.024Z (over 1 year ago)
- Language: JavaScript
- Size: 46.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PDFjs.WinUI
This is a WebView2-based wrapper of PDF.js for WinUI 3 / WinAppSDK. It is optimized to be used for PDF files generated by TeX. It uses the prebuilt version 2.12.313 from https://mozilla.github.io/pdf.js/getting_started/#download.
If you want to use your own version of PDF.js and just want to know how to get it to run within a WebView2 control, "SetVirtualHostNameToFolderMapping()" does the trick, e.g.:
``` csharp
private async void PDFjsViewerWebView_CoreWebView2Initialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
{
string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
sender.CoreWebView2.SetVirtualHostNameToFolderMapping("pdfjs", path, CoreWebView2HostResourceAccessKind.DenyCors);
PDFjsViewerWebView.Source = new("https://pdfjs/web/viewer.html");
}
```
## Screenshot

## Features
- Open a PDF file (StorageFile)
- Change the theme (Light/Dark)
- viewer.css has been tweaked to show Win11-styled scrollbars (adapting to the theme)
- viewer.html and viewer.js have been tweaked to automatically show the outline instead of thumbnails.
- viewer.html and viewer.js have been tweaked to always use page-width, like Overleaf does. Zooming is disabled.
- Page property is two-way bindable
## ToDo
- SyncTeX functionality (scroll to a specific position; listen to double-click events)
- Implement more two-way bindable properties