-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
834567: Sample on How to Add Rectangle Annotations Using Search Text …
…Bounds
- Loading branch information
1 parent
6404d87
commit e13826f
Showing
19 changed files
with
84 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
84 changes: 84 additions & 0 deletions
84
How to/Add Rectangle Annotations Using Search Text Bounds/src/app/app.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { Component, OnInit, ViewChild } from '@angular/core'; | ||
import { | ||
LinkAnnotationService, | ||
BookmarkViewService, | ||
MagnificationService, | ||
ThumbnailViewService, | ||
ToolbarService, | ||
NavigationService, | ||
AnnotationService, | ||
TextSearchService, | ||
TextSelectionService, | ||
FormFieldsService, | ||
FormDesignerService, | ||
PrintService | ||
} from '@syncfusion/ej2-angular-pdfviewer'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
template: ` | ||
<div class="content-wrapper"> | ||
<div style="margin-top: 20px;"> | ||
<button (click)="handleSearch()">Search PDF</button> | ||
<button (click)="handleSearchNext()">Search Next</button> | ||
<button (click)="handleCancelSearch()">Cancel Search</button> | ||
</div> | ||
<ejs-pdfviewer #pdfViewer | ||
id="pdfViewer" | ||
[documentPath]='document' | ||
[resourceUrl]='resource' | ||
style="height:640px;display:block" | ||
(textSearchHighlight)="handleTextSearchHighlight($event)"> | ||
</ejs-pdfviewer> | ||
</div> | ||
`, | ||
providers: [ | ||
LinkAnnotationService, | ||
BookmarkViewService, | ||
MagnificationService, | ||
ThumbnailViewService, | ||
ToolbarService, | ||
NavigationService, | ||
AnnotationService, | ||
TextSearchService, | ||
TextSelectionService, | ||
FormFieldsService, | ||
FormDesignerService, | ||
PrintService | ||
] | ||
}) | ||
export class AppComponent implements OnInit { | ||
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf'; | ||
public resource: string = 'https://cdn.syncfusion.com/ej2/28.1.33/dist/ej2-pdfviewer-lib'; | ||
pdfViewerComponent: any; | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
handleSearch() { | ||
var pdfviewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; | ||
pdfviewer.textSearchModule.searchText('PDF', false); | ||
} | ||
|
||
handleSearchNext() { | ||
var pdfviewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; | ||
pdfviewer.textSearchModule.searchNext(); | ||
} | ||
|
||
handleCancelSearch() { | ||
var pdfviewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; | ||
pdfviewer.textSearchModule.cancelTextSearch(); | ||
} | ||
|
||
handleTextSearchHighlight(args: any) { | ||
var pdfviewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; | ||
console.log(args); | ||
const bounds = args.bounds; | ||
pdfviewer.annotationModule.addAnnotation('Rectangle', { | ||
pageNumber: args.pageNumber, | ||
offset: { x: bounds.left, y: bounds.top }, | ||
width: bounds.width, | ||
height: bounds.height, | ||
}); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 0 additions & 51 deletions
51
How to/Get co-ordinates of Annotations/src/app/app.component.ts
This file was deleted.
Oops, something went wrong.