Skip to content

Commit 8e8264e

Browse files
996399: Updated Sample for Text Search
1 parent 307b1c5 commit 8e8264e

File tree

14 files changed

+50
-66
lines changed

14 files changed

+50
-66
lines changed

Text Search and Extraction/Text Search Events/src/app/app.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

Text Search and Extraction/Text Search Events/.gitignore renamed to Text Search and Extraction/Text Search Features and Events/.gitignore

File renamed without changes.

Text Search and Extraction/Text Search Events/README.md renamed to Text Search and Extraction/Text Search Features and Events/README.md

File renamed without changes.

Text Search and Extraction/Text Search Events/e2e/index.spec.js renamed to Text Search and Extraction/Text Search Features and Events/e2e/index.spec.js

File renamed without changes.

Text Search and Extraction/Text Search Events/e2e/protractor.conf.js renamed to Text Search and Extraction/Text Search Features and Events/e2e/protractor.conf.js

File renamed without changes.

Text Search and Extraction/Text Search Events/gulpfile.js renamed to Text Search and Extraction/Text Search Features and Events/gulpfile.js

File renamed without changes.

Text Search and Extraction/Text Search Events/license renamed to Text Search and Extraction/Text Search Features and Events/license

File renamed without changes.

Text Search and Extraction/Text Search Events/package.json renamed to Text Search and Extraction/Text Search Features and Events/package.json

File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import {
2+
PdfViewer, Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
3+
ThumbnailView, BookmarkView, TextSelection, TextSearch
4+
} from '@syncfusion/ej2-pdfviewer';
5+
6+
// Register required modules
7+
PdfViewer.Inject(
8+
Toolbar, Magnification, Navigation, Annotation, LinkAnnotation,
9+
ThumbnailView, BookmarkView, TextSelection, TextSearch
10+
);
11+
12+
// Initialise viewer
13+
const pdfviewer: PdfViewer = new PdfViewer({
14+
enableTextSearch: true,
15+
documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
16+
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib'
17+
});
18+
pdfviewer.appendTo('#PdfViewer');
19+
20+
// --------- UI bindings ---------
21+
const txtSearch = document.getElementById('txtSearch') as HTMLInputElement;
22+
const chkMatchCase = document.getElementById('chkMatchCase') as HTMLInputElement;
23+
24+
(document.getElementById('btnSearch') as HTMLButtonElement).onclick = () => {
25+
pdfviewer.textSearch.searchText(
26+
txtSearch.value,
27+
chkMatchCase.checked
28+
);
29+
};
30+
31+
(document.getElementById('btnNext') as HTMLButtonElement).onclick = () => {
32+
pdfviewer.textSearch.searchNext();
33+
};
34+
35+
(document.getElementById('btnPrev') as HTMLButtonElement).onclick = () => {
36+
pdfviewer.textSearch.searchPrevious();
37+
};
38+
39+
(document.getElementById('btnCancel') as HTMLButtonElement).onclick = () => {
40+
pdfviewer.textSearch.cancelTextSearch();
41+
};

Text Search and Extraction/Text Search Events/src/index.html renamed to Text Search and Extraction/Text Search Features and Events/src/index.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@
1212
</head>
1313

1414
<body>
15-
<!-- custom toolbar -->
15+
<!-- Search controls -->
1616
<div class="toolbar">
17-
<input id="txtSearch" type="text" placeholder="Search text" />
18-
<label><input type="checkbox" id="chkCase" /> Match case</label>
19-
<label><input type="checkbox" id="chkWhole" /> Whole word</label>
17+
<input type="text" id="txtSearch" placeholder="Search text" />
18+
<label><input type="checkbox" id="chkMatchCase"> Match Case</label>
19+
<label><input type="checkbox" id="chkWholeWord"> Whole Word</label>
2020

2121
<button id="btnSearch">Search</button>
22-
<button id="btnPrev">Prev Match</button>
23-
<button id="btnNext">Next Match</button>
24-
25-
<span id="resultInfo"></span>
22+
<button id="btnNext">Next</button>
23+
<button id="btnPrev">Previous</button>
24+
<button id="btnCancel">Cancel</button>
2625
</div>
2726

28-
<!-- PDF Viewer host -->
29-
<div id="pdfViewer"></div>
27+
<!-- PDF Viewer host element -->
28+
<div id="PdfViewer"></div>
3029

3130
</body>
3231

0 commit comments

Comments
 (0)