Conversation
Reviewer's GuideAdds client- and server-side support for rotating PDF pages in the PdfReader component, wiring new toolbar buttons to a JavaScript rotation function and deprecating the old rotation path via pdf.js. Sequence diagram for new PDF rotation interactions in PdfReadersequenceDiagram
actor "User"
participant "PdfReader (Razor Component)"
participant "Blazor JSRuntime"
participant "PdfReader.razor.js"
participant "pdfViewer (pdf.js viewer instance)"
"User" ->> "PdfReader (Razor Component)": "Click rotate-left toolbar button"
"PdfReader (Razor Component)" ->> "Blazor JSRuntime": "InvokeVoidAsync(\"rotate\", Id, -90)"
"Blazor JSRuntime" ->> "PdfReader.razor.js": "Call rotate(id, -90)"
"PdfReader.razor.js" ->> "pdfViewer (pdf.js viewer instance)": "Lookup via Data.get(id)"
"PdfReader.razor.js" ->> "pdfViewer (pdf.js viewer instance)": "Update pagesRotation with offset -90 (mod 360)"
"User" ->> "PdfReader (Razor Component)": "Click rotate-right toolbar button"
"PdfReader (Razor Component)" ->> "Blazor JSRuntime": "InvokeVoidAsync(\"rotate\", Id, 90)"
"Blazor JSRuntime" ->> "PdfReader.razor.js": "Call rotate(id, 90)"
"PdfReader.razor.js" ->> "pdfViewer (pdf.js viewer instance)": "Lookup via Data.get(id)"
"PdfReader.razor.js" ->> "pdfViewer (pdf.js viewer instance)": "Update pagesRotation with offset 90 (mod 360)"
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.
Hey there - I've reviewed your changes - here's some feedback:
- In PdfReader.razor.js, the rotation baseline
let rotate = pdfViewer.pagesRotation || 360;will treat an existing 0° rotation as falsy and reset to 360°; consider using a null/undefined check (e.g.,?? 0) so 0 remains a valid rotation state. - It may be worth validating the
offsetparameter in the newrotateJS function (e.g., ensuring it is a multiple of 90) to avoid ending up with non-standard rotation angles if the API is misused.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In PdfReader.razor.js, the rotation baseline `let rotate = pdfViewer.pagesRotation || 360;` will treat an existing 0° rotation as falsy and reset to 360°; consider using a null/undefined check (e.g., `?? 0`) so 0 remains a valid rotation state.
- It may be worth validating the `offset` parameter in the new `rotate` JS function (e.g., ensuring it is a multiple of 90) to avoid ending up with non-standard rotation angles if the API is misused.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR adds page rotation functionality to the PdfReader component, allowing users to rotate PDF pages left and right by 90-degree increments. The implementation replaces an older, unused rotation function with a new approach that leverages the pdf.js viewer's built-in pagesRotation property.
Key Changes
- Added
RotateLeft()andRotateRight()public methods in C# that rotate pages by -90° and +90° respectively - Implemented a new
rotate(id, offset)JavaScript function that manipulates thepagesRotationproperty of the PDFViewer - Added UI buttons in the toolbar for both rotation directions with Font Awesome icons
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| PdfReader.razor.js | Added new rotate() function using pdf.js viewer API; commented out old rotation implementation |
| PdfReader.razor.cs | Added RotateLeft() and RotateRight() public async methods with version bump |
| PdfReader.razor | Added two rotation button elements to toolbar with click handlers |
| BootstrapBlazor.PdfReader.csproj | Updated version to 10.0.1-beta01; includes commented PackageReference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Link issues
fixes #712
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add bidirectional page rotation controls to the PdfReader component and wire them to a new client-side rotation implementation.
New Features:
Enhancements: