Skip to content

Commit 13009ec

Browse files
authored
PDF Viewer demos update (#936)
* PDF demos updated
1 parent 183a4b2 commit 13009ec

File tree

4 files changed

+51
-3
lines changed

4 files changed

+51
-3
lines changed

BlazorBootstrap.Demo.RCL/Components/Pages/PdfViewer/PdfViewerDocumentation.razor

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<Demo Type="typeof(PdfViewer_Demo_03_Base64String)" Tabs="true" />
3131
</Section>
3232

33+
<Section Size="HeadingSize.H2" Name="RTL doc" PageUrl="@pageUrl" Link="rtl-doc">
34+
<Callout HideHeading="true">Below screenshot is added for demo purposes only. For additional info, refer to this <a href="https://github.com/vikramlearning/blazorbootstrap/issues/919">link</a>.</Callout>
35+
<Image Src="https://github.com/user-attachments/assets/2a2afd0d-9065-456c-9866-db10f81b7780" Alt="Blazor Bootstrap: Blazor PDF Viewer Component - RTL doc"/>
36+
</Section>
37+
3338
@code {
3439
private const string pageUrl = RouteConstants.Demos_PDFViewer_Documentation;
3540
private const string pageTitle = "Blazor PDF Viewer";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<p>@eventLog</p>
2+
3+
<PdfViewer Class="mb-3"
4+
Url="_content/BlazorBootstrap.Demo.RCL/docs/persian-sample-doc-919.pdf"
5+
OnDocumentLoaded="OnDocumentLoaded"
6+
OnPageChanged="OnPageChanged" />
7+
8+
@code {
9+
private string eventLog { get; set; } = $"Last event: ..., CurrentPage: 0, TotalPages: 0";
10+
11+
private void OnDocumentLoaded(PdfViewerEventArgs args)
12+
=> eventLog = $"Last event: OnDocumentLoaded, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";
13+
14+
private void OnPageChanged(PdfViewerEventArgs args)
15+
=> eventLog = $"Last event: OnPageChanged, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";
16+
}
Binary file not shown.

docs/docs/05-components/pdf-viewer.mdx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The Blazor PDF Viewer component allows users to view PDF files directly in the b
5656
}
5757
```
5858

59-
[See demo here.](https://demos.blazorbootstrap.com/pagination#examples)
59+
[See demo here.](https://demos.blazorbootstrap.com/pdf-viewer#examples)
6060

6161
### Orientation
6262

@@ -85,7 +85,7 @@ Set the `Orientation` parameter to `Orientation.Landscape` to change the default
8585
}
8686
```
8787

88-
[See demo here.](https://demos.blazorbootstrap.com/pagination#orientation)
88+
[See demo here.](https://demos.blazorbootstrap.com/pdf-viewer#orientation)
8989

9090
### Base64String
9191

@@ -120,4 +120,31 @@ Pdf Viewer component supports **base64** string as a URL.
120120
}
121121
```
122122

123-
[See demo here.](https://demos.blazorbootstrap.com/pagination#base64-string)
123+
[See demo here.](https://demos.blazorbootstrap.com/pdf-viewer#base64-string)
124+
125+
### RTL doc
126+
127+
<img src="https://github.com/user-attachments/assets/2a2afd0d-9065-456c-9866-db10f81b7780" alt="Blazor Bootstrap: Blazor PDF Viewer Component - RTL doc" />
128+
129+
:::info
130+
Below screenshot is added for demo purposes only. For additional info, refer to this <a href="https://github.com/vikramlearning/blazorbootstrap/issues/919">link</a>.
131+
:::
132+
133+
```cshtml {} showLineNumbers
134+
<p>@eventLog</p>
135+
136+
<PdfViewer Class="mb-3"
137+
Url="_content/BlazorBootstrap.Demo.RCL/docs/persian-sample-doc-919.pdf"
138+
OnDocumentLoaded="OnDocumentLoaded"
139+
OnPageChanged="OnPageChanged" />
140+
141+
@code {
142+
private string eventLog { get; set; } = $"Last event: ..., CurrentPage: 0, TotalPages: 0";
143+
144+
private void OnDocumentLoaded(PdfViewerEventArgs args)
145+
=> eventLog = $"Last event: OnDocumentLoaded, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";
146+
147+
private void OnPageChanged(PdfViewerEventArgs args)
148+
=> eventLog = $"Last event: OnPageChanged, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";
149+
}
150+
```

0 commit comments

Comments
 (0)