1
0
-1

I need to use an external javascript library (https://github.com/mozilla/pdf.js) to convert pdf files to image files, but it just doesnt work when i upload it to maestro or the resources in the transact form space.

If I include de library in a html file outside maestro, it works like a charm, but as soon as i try to use it inside a maestro form it throws undefined whenever i call it.

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      It seems that theres somo issues when you use any library built with webpack and 'umd' as targetLibrary. To get this working i had to clone the git repo and specify 'var' as targetLibrary.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Benjamin.

        Probably you can solve this problem using this reference:

        Library Advanced Features

        At Custom JavaScript Library you'll find this:

        Write your JavaScript functions using a text editor, and save as a .js file, such as mycode.js.
        Drag the JavaScript Library widget from the palette to the Nuts and Bolts/JavaScript Libraries node. Specify a name.
        Click the browse button to upload and select your mycode.js file to be associated with this library. 

        You may now invoke functions in mycode.js using the following syntax: 
        library_name.function(a, b); 
        If you want two different versions of the library for PDF and HTML: 
        Create two versions of the .js file. Ensure that each library has the same functions, with the same signatures, but with appropriate implementations.
        Create a JavaScript Library object for each .js file, but check the checkbox to specify it's used for only HTML or only PDF respectively.
        Override the Library Name property (which defaults to the Field Name by default) so that both Libraries have the same Library Name. 
        This way you will be able to use the same syntax to call functions, and it will automatically have the right version of the library in either the HTML or PDF forms.

        Let me know if you solve the problem with these feedback.

          CommentAdd your comment...