Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jon2g/mauipdfjsviewer
A implementation of pdfjs for android wrapped into a nuget so you can just install and use it. Have fun :). Based on https://github.com/jfversluis/MauiPdfJsViewerSample
https://github.com/jon2g/mauipdfjsviewer
android contentview maui pdf pdfviewer viewer xamarin
Last synced: 3 months ago
JSON representation
A implementation of pdfjs for android wrapped into a nuget so you can just install and use it. Have fun :). Based on https://github.com/jfversluis/MauiPdfJsViewerSample
- Host: GitHub
- URL: https://github.com/jon2g/mauipdfjsviewer
- Owner: Jon2G
- License: mit
- Created: 2024-05-22T16:17:13.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T16:28:52.000Z (8 months ago)
- Last Synced: 2024-05-22T17:43:44.424Z (8 months ago)
- Topics: android, contentview, maui, pdf, pdfviewer, viewer, xamarin
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MauiPdfJSViewer
[![NuGet version (PdfJSViewer-MAUI)](https://img.shields.io/nuget/v/PdfJSViewer-MAUI.svg)](https://www.nuget.org/packages/PdfJSViewer-MAUI)
A implementation of pdfjs for android wrapped into a nuget so you can just install and use it. Have fun :).
Based on
https://github.com/jfversluis/MauiPdfJsViewerSample
Be sure to meet pdf.js Apache license details in your app https://github.com/mozilla/pdf.js
![Recording 2024-05-22 155352](https://github.com/Jon2G/MauiPdfJSViewer/assets/24820069/2d7bc38b-2bc2-42e0-a5f0-e9316917a266)Usage:
XAML
```
```
C#
```
private void Button_Clicked_FromAssets(object sender, EventArgs e)
{
pdfJsViewer.LoadPdfFromMauiAssets("sample.pdf");
}private async void Button_Clicked_FromStream(object sender, EventArgs e)
{
using var stream = await FileSystem.OpenAppPackageFileAsync("sample.pdf");
pdfJsViewer.LoadPdfFromSteam(stream);}
private async void Button_Clicked_FromPath(object sender, EventArgs e)
{
string fileName = $"{Guid.NewGuid():N}.pdf";string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), fileName);
using var pdfStream = await FileSystem.OpenAppPackageFileAsync("sample.pdf");
using (FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write))
pdfStream.CopyTo(file);pdfJsViewer.LoadPdfFromPath(filePath);
}
```