Integration of docusuit_ Document Generation engine: Weak Integration

This solution only requires to include a few lines of JavaScript code that can be copied and pasted from the docusuit_ backoffice in the same way that is done for the integration of a Google map in a third party website.

In this case we have again different options:

Iframe integration

The iframe integration is the simplest method of them all and only requires to copy somewhere in the webpage the following code that may be generated by the docusuit_ backend interface:

                                            <script src="http://your.domain.tld/legaldocx/js/legaldocx_api.js" type="text/javascript"></script>
                                            <script type="text/javascript">legaldocx_api.iframe({
                                              api_key: '31262957aba10120ecc65c7e2497d222c451d81a', //API key
                                              container: 'form_api', //id of the HTML element where the form will be integrated
                                              iframe_id: 'myIframe_id', //optional id for the iframe
                                              iframe_height: 500, //value in pixels
                                              iframe_width: 500, //value in pixels
                                              iframe_scrolling: 'auto', // optional scrolling option for the iframe
                                              document_format: 'docx', //optional restriction on document format
                                              url: 'http://your.domain.tld/legaldocx/api.php',
                                            });</script>
                                        

The parameters used include:

  • Required:
    • The API KEY for the corresponding web form (the value included is some random sample key).
    • The id of the HTML div where you want the web form to be inserted.
    • The URL address to your docusuit_ API: in the sample code we are assuming that docusuit_ is in a folder name “legaldocx” in your root web folder.
  • Optional:
    • An id for the iframe to simplify the manipulation of the CSS styles of its contents or additional JavaScript code.
    • The corresponding height and width (in pixels) of the iframe.
    • The scrolling properties of the iframe: yes, no or auto (optional).
    • The default document format offered to the user.
    • The web form id (not included in the above example) 'form_id'. One should only use these parameter if one uses the API key associated with an user and not the one of a particular web form.

AJAX integration

                                            <!--#include   file="Legaldocx.asp"-->
                                            <%
                                            set legaldocx = new Legaldocx
                                            legaldocx.getForm “FORM API KEY”
                                            %>
                                        

The way to include a web form generated via docusuit_ via AJAX may depend on the fact that your website is under the same domain that the backend installation of docusuit_ or not.

docusuit_ and website under the same domain

                                            <!--#include   file="Legaldocx.asp"-->
                                            <%
                                            set legaldocx = new Legaldocx
                                            legaldocx.getForm “FORM API KEY”
                                            %>
                                        

This is the simplest option. In this case you have to do practically the same that in the previous example. Include the code:

                                            <script src="http://your.domain.tld/legaldocx/js/legaldocx_api.js" type="text/javascript"></script>
                                            <script type="text/javascript">legaldocx_api.ajax({
                                              api_key: '31262957aba10120ecc65c7e2497d222c451d81a', //API key
                                              container: 'form_api', //id of the HTML element where the form will be integrated
                                              url: 'http://your.domain.tld/legaldocx/api.php',
                                            });</script>
                                        

The parameters used include:

  • Required:
    • The API KEY for the corresponding web form (the value included is some random sample key).
    • The id of the HTML div where you want the web form to be inserted.
    • The URL address to your docusuit_ API: in the sample code we are assuming that docusuit_ is in a folder name “legaldocx” in your root web folder.
  • Optional:
    • The default document format offered to the user.
    • The web form id (not included in the above example) 'form_id'. One should only use these parameter if one uses the API key associated with a user and not the one of a particular web form.
  • Advanced (optional):
    • 'ajax_vals': additional parameters that may be added to the web form for further processing.
    • 'ajax_method': request method: post (default value) or get.
    • 'ajax_async': boolean. Asyncronous (true) default value or syncronous (false).
docusuit_ and website under different domains

It may well happen that a single installation of docusuit_ is used for different websites under different domains.

Because the security features of AJAX we can not use the method described above but, fortunately, the procedure is equally simple.

In this case we need to copy into our website a simple script that establish an “AJAX bridge” with docusuit_ to avoid the security restrictions of AJAX.

Like the website may be based in a technology other than PHP we have included in the docusuit_ distribution the corresponding scripts not only for PHP but also for JAVA and ASP.

So the technological platform of the website is no impediment to the correct integration of docusuit_ into your website.

First copy from the “api_resources” folder of your docusuit_ installation the required JavaScript file:

  • api_resources/js/legaldocx_api.js

and paste it in a folder , accessible via web, of your domain (we have assumed in the example that it has been pasted in a folder called legaldocx of your root web folder). Now you need also to copy the “form” script in the corresponding language that will serve as bridge with the docusuit_ backend:

  • PHP: api_resources/php/form.php
  • JSP: api_resources/jsp/form.jsp
  • api_resources/php/form.asp

and paste it in your web server in a publically accessible folder then include as before the following chunk of javascript code wherever you want to insert your web form:

                                            <script src="http://your.domain.tld/legaldocx/js/legaldocx_api.js" type="text/javascript"></script>
                                            <script type="text/javascript">legaldocx_api.ajax({
                                              api_key: '31262957aba10120ecc65c7e2497d222c451d81a', //API key
                                              container: 'form_api', //id of the HTML element where the form will be integrated  
                                              url: 'http://your.domain.com/path_to_script/form.php',//change to .jsp     or .asp as required
                                            });</script>
                                        

Where again the parameters included are:

  • Required:
    • The API KEY for the corresponding web form (the value included is some random sample key).
    • The id of the HTML div where you want the web form to be inserted.
    • The URL address to your docusuit_ API: in the sample code we are assuming that docusuit_ is in a folder name “legaldocx” in your root web folder.
  • Optional:
    • The default document format offered to the user.
    • The web form id (not included in the above example) 'form_id'. One should only use these parameter if one uses the API key associated with an user and not the one of a particular web form.
  • Advanced (optional):
    • 'ajax_vals': additional parameters that may be added to the web form for further processing.
    • 'ajax_method': request method: post (default value) or get.
    • 'ajax_async': boolean. Asyncronous (true) default value or syncronous (false).