-
-
Notifications
You must be signed in to change notification settings - Fork 375
feat(PdfViewer): add ShowToolbar parameter #7594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a configurable ShowToolbar parameter to the PdfViewer sample and wires it to a new UI switch, while adjusting the sample PDF URL and component backing state to support toolbar visibility toggling. Sequence diagram for toggling PdfViewer ShowToolbar parametersequenceDiagram
actor User
participant Browser
participant PdfViewersComponent
participant PdfViewer
User->>Browser: Toggle ShowToolbar switch
Browser->>PdfViewersComponent: Update _showToolbar via binding
PdfViewersComponent->>PdfViewer: Render with ShowToolbar = _showToolbar and updated Url
PdfViewer-->>User: Display PDF with toolbar visibility applied
Updated class diagram for PdfViewers sample component backing classclassDiagram
class PdfViewers {
int _pageIndex
bool _showToolbar
Task OnLoaded()
Task NotSupportCallback()
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- In the sample, the URL is hard-coded with
#toolbar=0&navpanes=0whileShowToolbaris bound to_showToolbar; consider aligning these so the newShowToolbarparameter is the single source of truth for toolbar visibility to avoid confusing or conflicting behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the sample, the URL is hard-coded with `#toolbar=0&navpanes=0` while `ShowToolbar` is bound to `_showToolbar`; consider aligning these so the new `ShowToolbar` parameter is the single source of truth for toolbar visibility to avoid confusing or conflicting behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7594 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 749 749
Lines 32988 32988
Branches 4578 4578
=========================================
Hits 32988 32988
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates the server demo to expose the new ShowToolbar option for PdfViewer and bumps the BootstrapBlazor.PdfViewer package version to a release that includes the parameter.
Changes:
- Add
_showToolbarstate and a UI switch to toggle toolbar visibility in the PdfViewer sample. - Pass the new
ShowToolbarparameter to<PdfViewer />in the sample. - Update
BootstrapBlazor.PdfViewerpackage reference from10.0.0to10.0.1.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor.cs | Adds backing field to support toolbar toggle in the sample. |
| src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor | Adds a switch and wires ShowToolbar into the PdfViewer demo. |
| src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj | Bumps PdfViewer package to pick up the new parameter. |
Comments suppressed due to low confidence (1)
src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor.cs:16
- Field '_useGoogleDocs' can be 'readonly'.
private bool _useGoogleDocs = false;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </section> | ||
| <PdfViewer Url="./samples/sample.pdf" Height="620px" PageIndex="@_pageIndex" | ||
| NotSupportCallback="NotSupportCallback" OnLoaded="OnLoaded" | ||
| <PdfViewer Url="./samples/sample.pdf#toolbar=0&navpanes=0" Height="620px" PageIndex="@_pageIndex" |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Url is now hardcoded with #toolbar=0&navpanes=0, which will force the browser PDF plugin to hide the toolbar regardless of the new ShowToolbar parameter. This makes the toggle ineffective and can also conflict with PdfViewer’s own URL handling. Consider keeping Url as the raw PDF path and let ShowToolbar control toolbar visibility (or dynamically append/remove the fragment based on _showToolbar).
| <PdfViewer Url="./samples/sample.pdf#toolbar=0&navpanes=0" Height="620px" PageIndex="@_pageIndex" | |
| <PdfViewer Url="./samples/sample.pdf" Height="620px" PageIndex="@_pageIndex" |
|
|
||
| private int _pageIndex = 1; | ||
|
|
||
| private bool _showToolbar = true; |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field '_showToolbar' can be 'readonly'.
| private bool _showToolbar = true; | |
| private readonly bool _showToolbar = true; |
| @@ -17,6 +17,8 @@ public partial class PdfViewers | |||
|
|
|||
| private int _pageIndex = 1; | |||
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field '_pageIndex' can be 'readonly'.
| private int _pageIndex = 1; | |
| private readonly int _pageIndex = 1; |
Link issues
fixes #7588
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add configurable toolbar visibility to the PDF viewer sample component.
New Features:
Enhancements: