Skip to content

Commit c90922d

Browse files
committed
Enhances CI/CD security and documentation
* **Security:** Updates the release workflow to utilize the built-in `GITHUB_TOKEN` for publishing, improving security and aligning with GitHub Actions best practices. * **Documentation:** Improves the readability of the README file by adding consistent spacing between sections and reformatting the properties table for better alignment.
1 parent e9f1f0e commit c90922d

2 files changed

Lines changed: 51 additions & 43 deletions

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ jobs:
9999
if: startsWith(github.ref, 'refs/tags/v')
100100
uses: softprops/action-gh-release@v2
101101
with:
102+
token: ${{ secrets.GITHUB_TOKEN }}
102103
files: ./artifacts/*.nupkg
103-
generate_release_notes: true
104-
token: ${{ secrets.GH_PAT }}
104+
generate_release_notes: true

README.md

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ MauiNativePdfView brings native PDF viewing capabilities to your .NET MAUI appli
3636
## ✨ Features
3737

3838
### Core Functionality
39+
3940
-**Multiple PDF Sources** - Load from files, URLs, streams, byte arrays, or embedded assets
4041
-**Password Protection** - Full support for encrypted PDFs
4142
-**Zoom & Gestures** - Pinch-to-zoom, double-tap zoom, with configurable min/max levels
@@ -45,6 +46,7 @@ MauiNativePdfView brings native PDF viewing capabilities to your .NET MAUI appli
4546
-**Scroll Orientation** - Vertical or horizontal page layout
4647

4748
### Advanced Features
49+
4850
-**Annotation Rendering** - Toggle PDF annotations on/off
4951
-**Annotation Events** - Tap detection with annotation details (iOS)
5052
-**Quality Control** - Antialiasing and rendering quality settings
@@ -53,6 +55,7 @@ MauiNativePdfView brings native PDF viewing capabilities to your .NET MAUI appli
5355
-**Event System** - Comprehensive events for document lifecycle
5456

5557
### Events
58+
5659
- `DocumentLoaded` - Fires when PDF is loaded with page count and metadata
5760
- `PageChanged` - Current page and total page count updates
5861
- `LinkTapped` - User taps on a link with URI and destination
@@ -64,16 +67,19 @@ MauiNativePdfView brings native PDF viewing capabilities to your .NET MAUI appli
6467
## 📦 Installation
6568

6669
### NuGet Package Manager
70+
6771
```bash
6872
dotnet add package MauiNativePdfView
6973
```
7074

7175
### Package Manager Console
76+
7277
```powershell
7378
Install-Package MauiNativePdfView
7479
```
7580

7681
### Requirements
82+
7783
- **.NET 9.0** or later
7884
- **iOS 12.2+** (PDFKit)
7985
- **Android 7.0+** (API 24+)
@@ -138,26 +144,26 @@ private void OnPageChanged(object sender, PageChangedEventArgs e)
138144

139145
### PdfView Properties
140146

141-
| Property | Type | Default | Description |
142-
|----------|------|---------|-------------|
143-
| `Source` | `PdfSource` | `null` | PDF source to display |
144-
| `EnableZoom` | `bool` | `true` | Enable pinch-to-zoom |
145-
| `EnableSwipe` | `bool` | `true` | Enable swipe gestures |
146-
| `EnableLinkNavigation` | `bool` | `true` | Enable clickable links |
147-
| `Zoom` | `float` | `1.0f` | Current zoom level |
148-
| `MinZoom` | `float` | `1.0f` | Minimum zoom level |
149-
| `MaxZoom` | `float` | `3.0f` | Maximum zoom level |
150-
| `PageSpacing` | `int` | `10` | Spacing between pages (pixels) |
151-
| `FitPolicy` | `FitPolicy` | `Width` | How pages fit on screen |
152-
| `DisplayMode` | `PdfDisplayMode` | `SinglePageContinuous` | Page display mode |
153-
| `ScrollOrientation` | `PdfScrollOrientation` | `Vertical` | Scroll direction |
154-
| `DefaultPage` | `int` | `0` | Initial page (0-based) |
155-
| `EnableAntialiasing` | `bool` | `true` | Antialiasing (Android only) |
156-
| `UseBestQuality` | `bool` | `true` | Best quality rendering |
157-
| `BackgroundColor` | `Color` | `null` | Viewer background color |
158-
| `EnableAnnotationRendering` | `bool` | `true` | Show PDF annotations |
159-
| `CurrentPage` | `int` | `0` | Current page (readonly) |
160-
| `PageCount` | `int` | `0` | Total pages (readonly) |
147+
| Property | Type | Default | Description |
148+
| --------------------------- | ---------------------- | ---------------------- | ------------------------------ |
149+
| `Source` | `PdfSource` | `null` | PDF source to display |
150+
| `EnableZoom` | `bool` | `true` | Enable pinch-to-zoom |
151+
| `EnableSwipe` | `bool` | `true` | Enable swipe gestures |
152+
| `EnableLinkNavigation` | `bool` | `true` | Enable clickable links |
153+
| `Zoom` | `float` | `1.0f` | Current zoom level |
154+
| `MinZoom` | `float` | `1.0f` | Minimum zoom level |
155+
| `MaxZoom` | `float` | `3.0f` | Maximum zoom level |
156+
| `PageSpacing` | `int` | `10` | Spacing between pages (pixels) |
157+
| `FitPolicy` | `FitPolicy` | `Width` | How pages fit on screen |
158+
| `DisplayMode` | `PdfDisplayMode` | `SinglePageContinuous` | Page display mode |
159+
| `ScrollOrientation` | `PdfScrollOrientation` | `Vertical` | Scroll direction |
160+
| `DefaultPage` | `int` | `0` | Initial page (0-based) |
161+
| `EnableAntialiasing` | `bool` | `true` | Antialiasing (Android only) |
162+
| `UseBestQuality` | `bool` | `true` | Best quality rendering |
163+
| `BackgroundColor` | `Color` | `null` | Viewer background color |
164+
| `EnableAnnotationRendering` | `bool` | `true` | Show PDF annotations |
165+
| `CurrentPage` | `int` | `0` | Current page (readonly) |
166+
| `PageCount` | `int` | `0` | Total pages (readonly) |
161167

162168
### PdfSource Types
163169

@@ -223,17 +229,17 @@ pdfViewer.Reload();
223229
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
224230
xmlns:pdf="clr-namespace:MauiNativePdfView;assembly=MauiNativePdfView"
225231
x:Class="MyApp.PdfPage">
226-
232+
227233
<Grid RowDefinitions="Auto,*,Auto">
228-
234+
229235
<!-- Toolbar -->
230236
<HorizontalStackLayout Grid.Row="0" Padding="10" Spacing="10">
231237
<Button Text="" Clicked="OnPreviousPage" />
232238
<Button Text="" Clicked="OnNextPage" />
233239
<Button Text="Zoom In" Clicked="OnZoomIn" />
234240
<Button Text="Zoom Out" Clicked="OnZoomOut" />
235241
</HorizontalStackLayout>
236-
242+
237243
<!-- PDF Viewer -->
238244
<pdf:PdfView x:Name="pdfViewer"
239245
Grid.Row="1"
@@ -247,14 +253,14 @@ pdfViewer.Reload();
247253
PageChanged="OnPageChanged"
248254
LinkTapped="OnLinkTapped"
249255
Error="OnError" />
250-
256+
251257
<!-- Status Bar -->
252258
<Label x:Name="statusLabel"
253259
Grid.Row="2"
254260
Padding="10"
255261
HorizontalOptions="Center" />
256262
</Grid>
257-
263+
258264
</ContentPage>
259265
```
260266

@@ -266,17 +272,17 @@ public partial class PdfPage : ContentPage
266272
InitializeComponent();
267273
pdfViewer.Source = PdfSource.FromAsset("sample.pdf");
268274
}
269-
275+
270276
private void OnDocumentLoaded(object sender, DocumentLoadedEventArgs e)
271277
{
272278
statusLabel.Text = $"Loaded: {e.PageCount} pages - {e.Title}";
273279
}
274-
280+
275281
private void OnPageChanged(object sender, PageChangedEventArgs e)
276282
{
277283
statusLabel.Text = $"Page {e.PageIndex + 1} of {e.PageCount}";
278284
}
279-
285+
280286
private void OnLinkTapped(object sender, LinkTappedEventArgs e)
281287
{
282288
if (e.Uri != null)
@@ -290,29 +296,29 @@ public partial class PdfPage : ContentPage
290296
// Internal link - handled automatically
291297
}
292298
}
293-
299+
294300
private void OnError(object sender, PdfErrorEventArgs e)
295301
{
296302
DisplayAlert("Error", e.Message, "OK");
297303
}
298-
304+
299305
private void OnPreviousPage(object sender, EventArgs e)
300306
{
301307
if (pdfViewer.CurrentPage > 0)
302308
pdfViewer.GoToPage(pdfViewer.CurrentPage - 1);
303309
}
304-
310+
305311
private void OnNextPage(object sender, EventArgs e)
306312
{
307313
if (pdfViewer.CurrentPage < pdfViewer.PageCount - 1)
308314
pdfViewer.GoToPage(pdfViewer.CurrentPage + 1);
309315
}
310-
316+
311317
private void OnZoomIn(object sender, EventArgs e)
312318
{
313319
pdfViewer.Zoom = Math.Min(pdfViewer.Zoom + 0.5f, pdfViewer.MaxZoom);
314320
}
315-
321+
316322
private void OnZoomOut(object sender, EventArgs e)
317323
{
318324
pdfViewer.Zoom = Math.Max(pdfViewer.Zoom - 0.5f, pdfViewer.MinZoom);
@@ -328,39 +334,39 @@ public class PdfViewModel : INotifyPropertyChanged
328334
private PdfSource _pdfSource;
329335
private int _currentPage;
330336
private int _pageCount;
331-
337+
332338
public PdfSource PdfSource
333339
{
334340
get => _pdfSource;
335341
set => SetProperty(ref _pdfSource, value);
336342
}
337-
343+
338344
public int CurrentPage
339345
{
340346
get => _currentPage;
341347
set => SetProperty(ref _currentPage, value);
342348
}
343-
349+
344350
public int PageCount
345351
{
346352
get => _pageCount;
347353
set => SetProperty(ref _pageCount, value);
348354
}
349-
355+
350356
public Command LoadPdfCommand { get; }
351357
public Command<int> GoToPageCommand { get; }
352-
358+
353359
public PdfViewModel()
354360
{
355361
LoadPdfCommand = new Command(LoadPdf);
356362
GoToPageCommand = new Command<int>(GoToPage);
357363
}
358-
364+
359365
private void LoadPdf()
360366
{
361367
PdfSource = PdfSource.FromAsset("document.pdf");
362368
}
363-
369+
364370
private void GoToPage(int pageIndex)
365371
{
366372
// Page navigation handled by binding
@@ -397,7 +403,7 @@ private void OnAnnotationTapped(object sender, AnnotationTappedEventArgs e)
397403
Console.WriteLine($"Type: {e.AnnotationType}");
398404
Console.WriteLine($"Contents: {e.Contents}");
399405
Console.WriteLine($"Bounds: {e.Bounds}");
400-
406+
401407
// Prevent default behavior
402408
e.Handled = true;
403409
}
@@ -436,12 +442,14 @@ private void OnAnnotationTapped(object sender, AnnotationTappedEventArgs e)
436442
## 🔧 Platform Details
437443

438444
### iOS (PDFKit)
445+
439446
- **Framework**: Apple's native PDFKit
440447
- **Version**: iOS 12.2+
441448
- **Features**: Full annotation support, smooth rendering
442449
- **Size**: 0 KB (system framework)
443450

444451
### Android (AhmerPdfium)
452+
445453
- **Library**: [AhmerPdfium](https://github.com/AhmerAfzal1/AhmerPdfium) by Ahmer Afzal
446454
- **Base**: Enhanced fork of [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer)
447455
- **Version**: 2.0.1 (viewer) + 1.9.2 (pdfium)

0 commit comments

Comments
 (0)