Backwards compatibility with MeadCo's ScriptX.Add-on for Internet Explorer
touching either button will return a PDF document of this page.
Old code
Current code will look something like this ...
factory.printing.header = "&D"; factory.printing.footer = ""; factory.printing.Print(false);
Or may be something like this ...
For example (free/basic usage):
<!-- MeadCo ScriptX --> <object id="factory" style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://[your path here]/smsx.cab#Version=8,0,0,56"> </object> <script src="/scripts/jquery-3.1.1.min.js" type="text/javascript"></script> <script src="/scripts/meadco-scriptx-1.10.1.js" type="text/javascript"></script> <script type="text/javascript"> $(window).on('load', function () { if (MeadCo.ScriptX.Init()) { MeadCo.ScriptX.Printing.header = "MeadCo's ScriptX&b:&p of &P:&bBasic Printing Sample"; MeadCo.ScriptX.Printing.footer = "The de facto standard for advanced web-based printing"; MeadCo.ScriptX.Printing.orientation = "landscape"; $("#btnprint").click(function() { MeadCo.ScriptX.PrintPage(false); }); } }); </script>
Making it work
To make the old code work with MeadCos' Script.Print and bring controlled print output to any browser just requires a few javascript files are added along with the details on how to connect to the server:
<!-- no add-on --> <!-- latest version of library --> <script src="/scripts/jquery-3.1.1.min.js"></script> <script src="/scripts/meadco-scriptx-1.10.1.js"></script> <!-- Add ScriptX.Print libraries --> <script src="/scripts/meadco.scriptX/meadco-scriptx-core-1.11.1.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-print-1.11.1.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-printhtml-1.11.1.js"></script> <script data-meadco-printhtmlserver="htp://scriptx.print.meadroid.net" data-meadco-subscription="xxx-xxx-xxxxxxx-xxx" src="/scripts/meadco.scriptx/meadco-scriptxfactory-1.11.1.js"></script> <!-- code as it was before 'just works' --> <script type="text/javascript"> $(window).on('load', function () { if (MeadCo.ScriptX.Init()) { MeadCo.ScriptX.Printing.header = "MeadCo's ScriptX&b:&p of &P:&bBasic Printing Sample"; MeadCo.ScriptX.Printing.footer = "The de facto standard for advanced web-based printing"; MeadCo.ScriptX.Printing.orientation = "landscape"; $("#btnprint").click(function() { MeadCo.ScriptX.PrintPage(false); }); } }); </script>
Or, this works too ..
<!-- no add-on --> <script src="/scripts/jquery-3.1.1.min.js"></script> <!-- Add ScriptX.Print libraries --> <script src="/scripts/meadco.scriptX/meadco-scriptx-core-1.11.1.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-print-1.11.1.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-printhtml-1.11.1.js"></script> <script data-meadco-printhtmlserver="htp://scriptx.print.meadroid.net" data-meadco-subscription="xxx-xxx-xxxxxxx-xxx" src="/scripts/meadco.scriptx/meadco-scriptxfactory-1.11.1.js"></script> <script type="text/javascript"> $(window).on('load', function () { $("#btnprint").click(function() { factory.printing.header = "MeadCo's ScriptX.Print &b:&p of &P:&bCompatibility Sample"; factory.printing.footer = "The de facto standard for advanced web-based printing"; factory.printing.portrait = false; factory.printing.Print(false); }); } }); </script>
Moving forwards
Although the various javascript modules described here provide a quick to use emulation in javascript of ScriptX.Add-on for Internet Explorer they have an inherent problem by default which is the synchronous nature of some behaviour.
Javascript code calling REST APIs should be asynchronous (the A in ajax) but we have used synchronous calls because the Add-on provides synchronous APIs. The modules provide asynchronous alternatives and the MeadCoScriptXJS module provides an interface that hides differences between the add-on and javascript implementation so that the same code can be written for both.