I was finding the JS API too.
On
http://src.chromium.org/viewvc/chrome/trunk/src/pdf/instance.cc
there are the following methods if someone need it:
object accessibility()
bool documentLoadComplete()
number getHeight()
number getHorizontalScrollbarThickness()
string getPageLocationNormalized()
number getVerticalScrollbarThickness()
number getWidth()
double getZoomLevel()
void goToPage(int arg)
void grayscale(bool arg)
void loadPreviewPage(string arg0, int arg1)
void onload(function arg)
void onPluginSizeChanged(function arg)
void onScroll(function arg)
number pageXOffset()
number pageYOffset()
void printPreviewPageCount(int arg)
void reload()
void removePrintButton()
void resetPrintPreviewUrl(string arg)
void sendKeyEvent(number arg)
void setPageNumbers(string arg)
void setPageXOffset(number arg)
void setPageYOffset(number arg)
void setZoomLevel(double arg)
void fitToHeight()
void fitToWidth()
void zoomIn()
void zoomOut()
void print()
an example to get the current page is like that
<html>
<head>
<script type='text/javascript'>
window.addEventListener('load', function(){
var embed = document.getElementsByName('plugin')[0];
// this method should return the page location (not the page number, i suppose that made some calculation on the portion of PDF that is showed in the embed window)
alert(embed.getPageLocationNormalized());
// we can use other api methods
embed.removePrintButton();
}, false);
</script>
</head>
<body marginwidth='0' marginheight='0' style='background-color: rgb(38,38,38)' width='100%' height='100%'>
<embed width='100%' height='100%' name='plugin' src='path_to_pdf_file' type='application/pdf' />
</body>
</html>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…