# Configuration:
- Web browser and its version: Chrome
- Operating system and its version: MacOS
- PDF.js version: 2.6.347
- Is a browser extension: No

# Steps to reproduce the problem:
1. Implement FindBar, including Find next / Find prev buttons

# What is the expected behavior? (add screenshot)

This might be intentional but seems a bit off. The PDFFindBar findPreviousButton / findNextButton should raise an event with options that can be passed directly to PDFindController.executeCommand

What went wrong? (add screenshot)

PDFBar raises an event on the EventBus which looks like this;

`this.eventBus.dispatch("find", { query: "hello",  ... type: "again" .... });`

https://github.com/mozilla/pdf.js/blob/00b4f86db301546d21d5dc79c61e2a9a829667a4/web/pdf_find_bar.js#L93-L105
[](url)
PDFFindController expects;

`pdfFindController.executeCommand("findagain", { query: "hello" });`

Which means you can't just pass the options through because the cmd doesn't match. Is there a reason PDFFindController doesn't just accept the following?

`pdfFindController.executeCommand("find", { query: "hello", type: "again" });`

Seems like it should work this way?

Thanks

Matches) ||
        (previous && offset.matchIdx > 0)
      ) {
        
        
        offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
        this._updateMatch( true);
        return;
      }
      
      
      this._advanceOffsetPage(previous);
    }
    
    this._nextPageMatch();
  }
  _matchesReady(matches) {
    const offset = this._offset;
    const numMatches = matches.length;
    const previous = this._state.findPrevious;
    if (numMatches) {
      
      offset.matchIdx = previous ? numMatches - 1 : 0;
      this._updateMatch( true);
      return true;
    }
    
    this._advanceOffsetPage(previous);
    if (offset.wrapped) {
      offset.matchIdx = null;
      if (this._pagesToSearch < 0) {
        
        this._updateMatch( false);
        
        
        return true;
      }
    }
    
    return false;
  }
  _nextPageMatch() {
    if (this._resumePageIdx !== null) {
      console.error("There can only be one pending page.");
    }
    let matches = null;
    do {
      const pageIdx = this._offset.pageIdx;
      matches = this._pageMatches[pageIdx];
      if (!matches) {
        
        
        this._resumePageIdx = pageIdx;
        break;
      }
    } while (!this._matchesReady(matches));
  }
  _advanceOffsetPage(previous) {
    const offset = this._offset;
    const numPages = this._linkService.pagesCount;
    offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
    offset.matchIdx = null;
    this._pagesToSearch--;
    if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
      offset.pageIdx = previous ? numPages - 1 : 0;
      offset.wrapped = true;
    }
  }
  _updateMatch(found = false) {
    let state = FindState.NOT_FOUND;
    const wrapped = this._offset.wrapped;
    this._offset.wrapped = false;
    if (found) {
      const previousPage = this._selected.pageIdx;
      this._selected.pageIdx = this._offset.pageIdx;
      this._selected.matchIdx = this._offset.matchIdx;
      state = wrappe