Reference

The Embedded Viewer API contains one class: DefaultViewer. For an introduction to using the API, see the Developer's Guide.

Constructor summary

google.books.DefaultViewer(div, opt_options)
An embedded viewer for a volume in Google Book Search.
 

Method summary

string getPageNumber()
Returns the page number of the page that's currently visible in the viewport.
string getPageId()
Returns a unique identifier for the page that's currently visible in the viewport.
boolean goToPage(pageNumber)
Returns true if the page exists and was turned to.
boolean goToPageId(pageId)
Returns true if the page exists and was turned to.
boolean isLoaded()
Indicates whether the viewer has been successfully initialized with the given book.
highlight(opt_string)
Highlights a term in the viewport.
load(identifiers, opt_notFoundCallback, opt_successCallback)
Loads a book in the viewport.
nextPage()
Goes to the next page in the book.
previousPage()
Goes to the previous page in the book.
resize()
Resizes the viewer to conform to size of its container div.
zoomIn()
Zooms into the viewer.
zoomOut()
Zooms out of the viewer.
 

Constructor detail

google.books.DefaultViewer

google.books.DefaultViewer(div, opt_options)
    An embedded viewer for a volume in Google Book Search.
    Parameters:
      Element div - Div to draw the viewport in.
      Object opt_options - Key-value map of options to pass along to the viewer.

Method detail

getPageNumber

string getPageNumber()
    Returns the page number of the page that's currently visible in the viewport.
    Returns:
      string 

getPageId

string getPageId()
    Returns a unique identifier for the page that's currently visible in the viewport.
    Returns:
      string 

goToPage

boolean goToPage(pageNumber)
    Returns true if the page exists and was turned to.
    Parameters:
      string, number pageNumber - The page number of the page to turn to.
    Returns:
      boolean 

goToPageId

boolean goToPageId(pageId)
    Returns true if the page exists and was turned to.
    Parameters:
      string pageId - The unique identifier of the page to turn to.
    Returns:
      boolean 

isLoaded

boolean isLoaded()
    Returns true if the viewer has been successfully initialized with the given book using load.
    Returns:
      boolean 

highlight

highlight(opt_string)
    Highlights a term in the viewport.
    Parameters:
      string opt_string - A string to highlight. Turns off highlighting if null or undefined.

load

load(identifiers, opt_notFoundCallback, opt_successCallback)
    Loads a book in the viewport.
    Parameters:
      string, Array of strings identifiers - A preview URL or book identifier such as an ISBN, OCLC, etc. See Dynamic Links request format. To specify several alternative identifiers for the book (e.g., the hardcover and softcover ISBNs), pass an Array of these identifier strings; the viewer will the viewer will load the first embeddable book in the array.
      Function opt_notFoundCallback - If identifier is a book identifier, this callback will be called if the book was not found. If null passed or this parameter is omitted, no function will be called on failure.
      Function opt_successCallback - This callback will be executed if and when the viewer is successfully instantiated with a particular book, and ready to receive function calls such as nextPage.

nextPage

nextPage()
    Goes to the next page in the book.

previousPage

previousPage()
    Goes to the previous page in the book.

resize

resize()
    Resizes the viewer to conform to size of its container div.

zoomIn

zoomIn()
    Zooms into the viewer.

zoomOut

zoomOut()
    Zooms out of the viewer.

Back to top