Flexpaper apis won't work in any way

962 views Asked by At

Everything works in flexpaper but it's api ...

I' using the free version of flexpaper but when I use their API like:

function onDocumentLoaded(totalPages){
    getDocViewer().searchText('UK');
}

as shown in Flexpaper examples, but nothing seems to work...

Anyone already had this issue? Thanks

2

There are 2 answers

0
forzayalta On

You can try this code:

<script type="text/javascript">   
$(function() {
    $('#documentViewer').bind('onDocumentLoaded',function(){
        window.$FlexPaper = window.getDocViewer = window["$FlexPaper"] = function(id){
            var instance = (id==="undefined")?"":id;

            if (window['ViewerMode'] == 'flash') {
                return window["FlexPaperViewer_Instance"+instance].getApi();
            }else if(window['ViewerMode'] == 'html'){
                return window["FlexPaperViewer_Instance"+instance];
            }
        };
        $FlexPaper('documentViewer').searchText('UK');
    });
});
</script>

Where $FlexPaper is your FlexPaper instance's ID

0
john On

Not sure what version of FlexPaper you are using, but I noticed that somewhere between 1.4.2 and 1.5.1 the getDocViewer function was silently removed from the support javascript code. There is no mention of this removal in the change log.