Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
3Activity
×
0 of .
Results for:
No results containing your search query
P. 1
6880895bfc6eb250788636d955ef1aa0

6880895bfc6eb250788636d955ef1aa0

Ratings: (0)|Views: 262|Likes:
Published by phpfoxg

More info:

Published by: phpfoxg on Dec 04, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, DOC, TXT or read online from Scribd
See More
See less

10/10/2013

pdf

text

original

 
Scribd Reader Javascript API
 To embed Scribd documents in your web application, you'll use the Javascript API. Youcan use the API to just get a default embed using a document ID / access key pair (seecode snippet below), and you can customize your embed in many ways.
Contents
1.
2.
3.
4.
5.
6.
7.
8.
9.
Getting Started
Using Scribd Reader's Javascript API is easy. To get started, most users can follow thesesteps:1.Include Scribd's View.js2.Create a document object3.Pass it either a doc ID / access key pair (returned by the server-side API) or a URLto a document4.Call the document object's write method You can use the following code to create a bare-bones Scribd Reader installation with APIsupport:<script type='text/javascript' src='http://www.scribd.com/javascripts/view.js'></script><div id='embedded_flash'><a href="http://www.scribd.com">Scribd</a></div><script type="text/javascript">var scribd_doc = scribd.Document.getDoc( 2659, 'key-6vhdaqehjkeob' );var oniPaperReady = function(e){// scribd_doc.api.setPage(3);}scribd_doc.addParam( 'jsapi_version', 1 );scribd_doc.addEventListener( 'iPaperReady', oniPaperReady );scribd_doc.write( 'embedded_flash' );</script>
 
Constructors
scribd.Document.getDoc
( document_id , access_key )
 This constructor gets an existing Scribd Reader document. You'll need thedocument_id and access_key to embed the document. You can get these from theScribd API if you're using it or from the doc's page on Scribd.
scribd.Document.getDocFromUrl
( url , scribd_publisher_id )
 This constructor creates a Scribd Reader from the URL of a document. To get therequired scribd_publisher_id, you'll need to create a Scribd API account. The URLneeds to be a document type supported by Scribd, like a PDF, not a normal HTMLwebpage.
Properties
api
Only available once Scribd Reader has signaled it'sready. This property is areference to Scribd Reader's javascript interface. View the availableapi methodsinthe following section.
Methods
write
( element_id:Number )
Builds the appropriate embed code, which is written to the specified target'sinnerHTML. We recommend using a DIV tag or other block-level element with thismethod.
addParam
( key:Number, value:String )
Used to specify Scribd Reader attributes and behavior. Must be called beforewrite(). See theparametersection below for supported parameters.
addEventListener
( eventType:String, callback:Function )
Used to assign a listener to Scribd Reader events. See theeventssection forsupported event types, and theexamplessection for relevant sample code.
removeEventListener
( eventType:String, callback:Function )
Used to remove a Scribd Reader event listener. See theeventssection forsupported event types, and theexamplessection for relevant sample code.
api.getPageCount
( ):Number 
Returns the total number of pages in the document.
api.getPage
( ):Number 
Returns the current page as displayed in the toolbar.
api.setPage
( pageNumber:Number )
 Jumps to the specified page. Input is bound between 0 and the current page count.
api.getZoom
( ):Number 
Returns the current zoom factor, where a value of 1 is equal to a zoom factor of 100%.
api.setZoom
( zoomFactor:Number )
Accepts a zoom factor, where a value of 1 is equal to a zoom factor of 100%.
api.getVerticalScroll
( ):Number 
Returns a position value, in the format required by api.setVerticalScroll().
 
api.setVerticalScroll
( scrollPosition:Number )
Parameter should be in the format of page.fraction, where the integer representswhich page to scroll to and the fraction represents how far down that page toscroll. For example, a value of 7.5 will scroll the viewport's upper edge to thesecond half of page seven.
api.getHorizontalScroll
( ):Number 
Returns a position value, in the format required by api.setHorizotalScroll().
api.setHorizontalScroll
( scrollPosition:Number )
A number between 0 and 1 which specifies where to align the left edge of theviewport. For example, a value of .5 will scroll the viewport so the left edge isaligned with the center of the current page. Input is sensibly bound between 0 and1.
api.getDocumentId
( ):String
Returns the document ID of the most recently loaded document.
api.loadDocument
( document_id:String, access_key:String )
Loads a document using its document id and access key.
api.loadDocumentFromUrl
( url:String, publisher_id:String )
Converts and loads the document located at the remote URL.
api.getViewMode
( ):String
Returns the current view mode of Scribd Reader as one of the following strings:"list", "book", "slide", "tile".
api.getFullscreen
( ):Boolean
Returns true if Scribd Reader is currently in fullscreen mode, false if not.
api.setFullscreen
( fullscreen:Boolean )
If fullscreen is true, Scribd Reader is switched into the fullscreen state. If false,Scribd Reader will return to its normal state.
api.getEmbedCode
( ):String
Returns the current document's embed code.
Events
SeeaddEventListener()orexamplesfor more information.
iPaperReady
Signals when it's safe to begin using the api object methods. Fired when iPaper hasfinished successfully loading the first page of the current document.
pageChanged
Fired whenever a user has moved to a new page. Use api.getPage() to get the newpage.
viewModeChanged
Fired when Scribd Reader has changed view modes. Use api.getViewMode() to getthe current view mode.
zoomChanged
Fired when the zoom level has changed. Use api.getZoom() to get the currentzoom level.
addParam()
Parameters

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->