From 7f707cb5a94cb69afe330f4c0f1eef1e97366204 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 29 Jul 2025 20:26:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20PageIndex=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapBlazor.PdfViewer/PdfViewer.razor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs b/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs index 07a4fb6f..1d349cdd 100644 --- a/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs +++ b/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs @@ -17,6 +17,12 @@ public partial class PdfViewer [Parameter] public string? Url { get; set; } + /// + /// Gets or sets the page index of the PDF file. + /// + [Parameter] + public int PageIndex { get; set; } + /// /// Gets or sets the viewer height. Default is null. /// @@ -108,7 +114,7 @@ private string GetAbsoluteUri(string? url) url ??= string.Empty; if (string.IsNullOrEmpty(url) || !UseGoogleDocs) { - return url; + return $"{url}#page={PageIndex}"; } var uri = NavigationManager.ToAbsoluteUri(url); return uri.AbsoluteUri; From e0cd2885be8d90eb076e57bd2d6f3243dfec21f0 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 29 Jul 2025 20:26:36 +0800 Subject: [PATCH 2/4] chore: bump version 9.0.4 --- .../BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj b/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj index e1e6b20a..02416840 100644 --- a/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj +++ b/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj @@ -1,7 +1,7 @@ - 9.0.3 + 9.0.4 From a517414d1188b7d14ab6b5158e7b7c797f7ebe72 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 29 Jul 2025 20:48:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=E6=94=AF=E6=8C=81=E9=A1=B5?= =?UTF-8?q?=E7=A0=81=E5=8F=98=E5=8C=96=E9=87=8D=E6=96=B0=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PdfViewer.razor.cs | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs b/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs index 1d349cdd..9e1accca 100644 --- a/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs +++ b/src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs @@ -58,9 +58,6 @@ public partial class PdfViewer .AddClass($"--bb-pdf-viewer-height: {Height};", !string.IsNullOrEmpty(Height)) .Build(); - private string? _url; - private bool _useGoogleDocs; - private string? UseGoogleDocsString => UseGoogleDocs ? "true" : null; /// @@ -72,29 +69,9 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); - if (firstRender) - { - _url = Url; - _useGoogleDocs = UseGoogleDocs; - return; - } - - var rerender = false; - if (_url != Url) - { - _url = Url; - rerender = true; - } - - if (_useGoogleDocs != UseGoogleDocs) - { - _useGoogleDocs = UseGoogleDocs; - rerender = true; - } - - if (rerender) + if (!firstRender) { - await InvokeVoidAsync("loadPdf", Id, GetAbsoluteUri(_url)); + await InvokeVoidAsync("loadPdf", Id, GetAbsoluteUri(Url)); } } From 7e5eea5765944e45267b5d706ad9abbcf427c68e Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 29 Jul 2025 20:48:52 +0800 Subject: [PATCH 4/4] chore: bump version 9.0.5 --- .../BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj b/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj index 02416840..eb120d22 100644 --- a/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj +++ b/src/components/BootstrapBlazor.PdfViewer/BootstrapBlazor.PdfViewer.csproj @@ -1,7 +1,7 @@ - 9.0.4 + 9.0.5