Menu

nsdejavu scripting interface

2010-01-12
2012-11-08
  • Paweł Mantur

    Paweł Mantur - 2010-01-12

    Hi,

    I am trying to make use of JavaScript interface of nsdejavu plugin in Firefox
    3.0.16. My tests show that by default this interface is not available. This is
    how I place DjVu contant on my page:

    <object id="user-content-djvu1" data="djvu3spec.djvu" type="image/vnd.djvu" width="75%" height="100%"> <param name="page" value="1"> <param name="zoom" value="stretch"> This browser cannot render djvu data. </object>

    And this how I try to use JavaScript interface:

    <script type="text/javascript"> function FunctionFiredByAbuttonClick\(\) \{ var v1 = document.getElementById\("djvu1"\); alert\(v1.version\); // 'undefined' is returned return false; \} </script>

    I looked at nsdejavu.c source file and there is a flag 'scriptable', it is by
    default 0, and it seems to be somehow set in StartProgram(void) function. My
    problem is that I have no idea how to activate this flag from HTML/javascript
    or browser settings(?). My temporary solution was to set this flag to 1 in
    sorce file and recompile the library. Now it works! But I suppose there must
    be some other way to enable scripting interface.

    I will appreciate any suggestions.

    Regards,

    Pawel

     
  • Paweł Mantur

    Paweł Mantur - 2010-01-12

    PS. What I should precise is that I use version 3.5.22 of DjVuLibre

     
  • Paweł Mantur

    Paweł Mantur - 2010-01-12

    It seems that it was wrong when I said that the solution of simply setting the
    'scriptable' frag to 1 works. Javascript functions and properties available,
    but when I invoke getdjvuopt('page') method, I got an exception 'uncaught
    exception: Error calling method on NPObject! .'. I suppose the plugin was not
    properly initialized.

    Waiting for your help…

     
  • Paweł Mantur

    Paweł Mantur - 2010-01-12

    …what is intersetnig setdjvuopt(key, value) works fine, while getdjvuopt
    doesn't as I said above

     

Log in to post a comment.

Auth0 Logo