Skip to content

Commit e1211f0

Browse files
975150: Added Proper Comments
1 parent db2884b commit e1211f0

File tree

1 file changed

+5
-0
lines changed
  • How to/Rotate and delete PDF pages using command manager/src

1 file changed

+5
-0
lines changed

How to/Rotate and delete PDF pages using command manager/src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { PdfDocument } from '@syncfusion/ej2-pdf';
2525
function App() {
2626
const viewerRef = React.useRef(null);
2727

28+
// Handle keyboard shortcuts (Alt+R: rotate right, Alt+L: rotate left, Alt+D: delete)
2829
function keyboardCustomCommands(args) {
2930
if (args.keyboardCommand.name === 'rotateCurrentPageRight') {
3031
rotate(45);
@@ -35,6 +36,7 @@ function App() {
3536
}
3637
}
3738

39+
// Rotate current page by specified degrees
3840
function rotate(degree) {
3941
viewerRef.current.saveAsBlob().then((value) => {
4042
const reader = new FileReader();
@@ -62,6 +64,7 @@ function App() {
6264
});
6365
}
6466

67+
// Delete the current page from PDF
6568
function deleteCurrentPage() {
6669
viewerRef.current.saveAsBlob().then((value) => {
6770
const reader = new FileReader();
@@ -97,6 +100,7 @@ function App() {
97100
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
98101
resourceUrl="https://cdn.syncfusion.com/ej2/30.1.37/dist/ej2-pdfviewer-lib"
99102
style={{ height: '640px' }}
103+
// Configure keyboard shortcuts and other props
100104
commandManager={{
101105
keyboardCommand: [
102106
{
@@ -147,5 +151,6 @@ function App() {
147151
);
148152
}
149153

154+
// Render the App
150155
const root = createRoot(document.getElementById('sample'));
151156
root.render(<App />);

0 commit comments

Comments
 (0)