@syncfusion/ej2-pdfviewer
Version:
Essential JS 2 PDF viewer Component
288 lines (287 loc) • 9.65 kB
TypeScript
import { PdfViewer, PdfViewerBase } from '../index';
import { DocumentTextCollectionSettingsModel, SearchResultModel } from '../pdfviewer-model';
import { AutoComplete } from '@syncfusion/ej2-dropdowns';
/**
* TextSearch module
*
* @param {Event} event - event
* @returns {void}
*/
export declare class TextSearch {
/**
* @private
*/
isTextSearch: boolean;
/**
* @private
*/
searchBtn: HTMLElement;
/**
* @private
*/
searchInput: HTMLElement;
/**
* @private
*/
searchCountEle: HTMLElement;
/**
* @private
*/
searchInputContainer: HTMLElement;
/**
* @private
*/
searchCount: number;
private currentOccurrence;
private pdfViewer;
private pdfViewerBase;
private searchBox;
private nextSearchBtn;
private prevSearchBtn;
private searchIndex;
private currentSearchIndex;
private startIndex;
private searchPageIndex;
private startSearchPageIndex;
private searchString;
private isMatchCase;
private isMultiSearch;
private isSingleSearch;
private searchAutocompleteObj;
private searchRequestHandler;
private textContents;
private searchMatches;
private multiSearchCounts;
private searchedPages;
private isPrevSearch;
private isExactMatch;
private autompleteDataSource;
private matchAnyWordCheckBox;
private searchedOccurrences;
private isSelectedFromPopup;
/**
* @private
*/
isDocumentTextCollectionReady: boolean;
private intervalId;
/**
* @private
*/
searchTextDivzIndex: string;
private tempElementStorage;
/**
* @private
*/
isMessagePopupOpened: boolean;
/**
* @private
*/
documentTextCollection: DocumentTextCollectionSettingsModel[][];
/**
* @private
*/
isTextRetrieved: boolean;
private isTextSearched;
private isTextSearchEventTriggered;
private isSearchText;
private isLastOccurrenceCompleted;
private isInitialSearch;
/**
* @param {PdfViewer} pdfViewer - It describes about the pdf viewer
* @param {PdfViewerBase} pdfViewerBase - It describes about the pdfviewer base
* @private
* @returns {void}
*/
constructor(pdfViewer: PdfViewer, pdfViewerBase: PdfViewerBase);
/**
* @private
* @returns {void}
*/
createTextSearchBox(): void;
private setLoaderProperties;
private showLoadingIndicator;
/**
* @private
* @returns {void}
*/
textSearchBoxOnResize(): void;
/**
* @param {boolean} isShow - It describes about the isShow
* @private
* @returns {void}
*/
showSearchBox(isShow: boolean): void;
/**
* @private
* @returns {void}
*/
searchAfterSelection(): void;
private calculateSearchCount;
private getSearchCountText;
private adjustInputContainerWidth;
private initiateTextSearch;
private handleSearchAfterTextCollectionReady;
/**
* @param {string} inputString - It describes about the input string
* @param {boolean} isMobileSearch - Indicates is mobile search or not
* @private
* @returns {void}
*/
initiateSearch(inputString: string, isMobileSearch?: boolean): void;
private textSearch;
private nextSearch;
private findNextPageWithText;
private findFirstNonEmptyPage;
private prevSearch;
private scrollToSearch;
private isScrollPages;
private findPreviousPageWithText;
private initSearch;
private getPossibleMatches;
private correctLinetext;
private getSearchTextContent;
private getSearchPage;
private areAllNonEmptyPagesSearched;
private areAllOccurencesSearched;
private highlightSearchedTexts;
private addDivForSearch;
private addDivElement;
private createSearchTextDiv;
private calculateBounds;
private isClassAvailable;
private getScrollElement;
private scrollToSearchStr;
/**
* @param {number} pageIndex - It describes about the page index
* @private
* @returns {void}
*/
resizeSearchElements(pageIndex: number): void;
/**
* @param {number} pageNumber - It describes about the page number
* @private
* @returns {void}
*/
highlightOtherOccurrences(pageNumber: number): void;
private highlightOthers;
/**
* @private
* @returns {void}
*/
clearAllOccurrences(): void;
/**
* @private
* @returns {any} - any
*/
getIndexes(): any;
private applyTextSelection;
/**
* @private
* @param {boolean} [cleardocumentCollection=false] - If true, clears the document text collection.
* @returns {void}
*/
resetTextSearch(cleardocumentCollection?: boolean): void;
private onTextSearchClose;
private createRequestForSearch;
private searchRequestOnSuccess;
/**
* @private
* @returns {void}
*/
getPDFDocumentTexts(): void;
/**
* @param {number} startIndex - It describes about the start index
* @param {number} endIndex - It describes about the end index
* @private
* @returns {void}
*/
createRequestForGetPdfTexts(startIndex: number, endIndex: number): void;
/**
* @private
* @param {any} data - It gets the data
* @param {number} startIndex - It gets the starting index
* @param {number} endIndex - It gets the ending index
* @returns {void}
*/
pdfTextSearchRequestSuccess(data: any, startIndex: number, endIndex: number): void;
private pdfTextSearchRequestOnSuccess;
private orderPdfTextCollections;
private createSearchBoxButtons;
private enablePrevButton;
private enableNextButton;
private checkBoxOnChange;
/**
* @private
* @returns {void}
*/
resetVariables(): void;
private searchKeypressHandler;
private searchClickHandler;
/**
* @param {HTMLElement} element - It describes about the element
* @param {HTMLElement} inputElement - It describes about the input element
* @param {boolean} isMobileSearch - It indicates is mobile search or not
* @private
* @returns {void}
*/
searchButtonClick(element: HTMLElement, inputElement: AutoComplete | HTMLElement, isMobileSearch?: boolean): void;
private updateSearchInputIcon;
private nextButtonOnClick;
private prevButtonOnClick;
private onMessageBoxOpen;
/**
* Searches the target text in the PDF document and highlights the occurrences in the pages
*
* @param {string} searchText - Specifies the searchText content
* @param {boolean} isMatchCase - If set true , its highlights the MatchCase content
* @returns {void}
*/
searchText(searchText: string, isMatchCase: boolean): void;
/**
* Searches the next occurrence of the searched text from the current occurrence of the PdfViewer.
*
* @returns {void}
*/
searchNext(): void;
/**
* Searches the previous occurrence of the searched text from the current occurrence of the PdfViewer.
*
* @returns {void}
*/
searchPrevious(): void;
/**
* Cancels the text search of the PdfViewer.
*
* @returns {void}
*/
cancelTextSearch(): void;
/**
* @private
* @returns {void}
*/
destroy(): void;
/**
* Searches for the specified text within the document and returns the bounding rectangles of the matched text. The search can be case-sensitive based on the provided parameters. If a specific page index is provided, it returns the bounding rectangles for that page; otherwise, it returns the bounding rectangles for all pages in the document where the text was found.
*
* @param {string} searchText - The text string to search for.
* @param {boolean} isMatchCase - If true, performs a case-sensitive search; otherwise, performs a case-insensitive search.
* @param {number} [pageIndex] - Optional page index to limit the search to a specific page.
* @returns {SearchResultModel[]} - An array of `SearchResult` objects, where each object contains the page index and an array of bounds representing the locations of the search text found on that page.
*/
findText(searchText: string, isMatchCase: boolean, pageIndex?: number): SearchResultModel[];
/**
* Searches for an array of strings within the document and returns the bounding rectangles for each occurrence. The search can be case-sensitive based on the provided parameters. If a specific page index is provided, it returns the bounding rectangles for these search strings on that page; otherwise, it returns the bounding rectangles for all pages in the document where the strings were found.
*
* @param {string[]} searchText - An array of text strings to search for.
* @param {boolean} isMatchCase - If true, performs a case-sensitive search; otherwise, performs a case-insensitive search.
* @param {number} [pageIndex] - Optional page index to limit the search to a specific page.
* @returns {Record<string, SearchResultModel[]>} - An object where each key is a search text string, and each value is an array of `SearchResult` objects. Each `SearchResult` object contains the page index and an array of bounds representing the locations of that search text on the corresponding page.
*/
findText(searchText: string[], isMatchCase: boolean, pageIndex?: number): Record<string, SearchResultModel[]>;
private calculateTextBounds;
/**
* @private
* @returns {void}
*/
getModuleName(): string;
}