Printing with ScriptX.Services
This walk-through illustrates taking a classic document that has a controlled print experience and works only in Internet Explorer and making it work with ScriptX.Services in any browser on any platform using the minimum amount of development effort and making as few changes as possible (though more changes might be desirable).
Previously : Stage 1 - Implement a simple UI
To work with ScriptX.Services requires the ScriptX.Services Client Library that implements compatibility to ScriptX.Addon for ScriptX.Services. The libraries can be configured with attributes describing the server to use.
The ScriptX.Services Server in use is ScriptX.Services for Windows PC which default listens on
4991. We can use the same license as we used with ScriptX.Add-on.
The following new code is needed:
<!-- Add.on to scriptx.services compatibility --> <script src="//firstname.lastname@example.org/dist/meadco-scriptxservices.min.js" data-meadco-license="370000ed-d40c-43d4-b3d3-f2e7d2eff47d" data-meadco-server="http://127.0.0.1:41191" data-meadco-license-path="warehouse" data-meadco-license-revision="0" data-meadco-syncinit="true" > </script>
That is all that is needed.
Browse to the sample
ScriptX.Services for Windows PC must be running on the PC. The services will not start on demand but they are started whenever a user logs-in.
If unsure, use the ScriptX.Services dashboard to check.
Open your browser (any browser) and go to the address https://scriptxprintsamples.meadroid.com/ThenToNow/Now
- If you have used Internet Explorer note that nothing has changed, everything works exactly as before (ScriptX.Add-on is still being used).
- If you use a browser such as Google Chrome or Microsft Edge then the buttons can be used to print the page.
If you use Internet Explorer then the ScriptX.Services Client Library does nothing and ScriptX.Addon implments printing.
What does not work with ScriptX.Services as it does with ScriptX.Add-on
- Print preview is not supported currently.
- The default is no prompt when printing - with ScriptX.Add-on the default is to prompt.
- Using the print options from the browser Print menu gives the browser print experience as it has not been overridden by ScriptX.Services.
Using other ScriptX.Services Servers
To use ScriptX.Services on Cloud or ScriptX.Services for On-Premise Devices then the attributes change, for example, to work with ScriptX.Services for On-Premise Devices:
<script src="//email@example.com/dist/meadco-scriptxservices.min.js" data-meadco-subscription="" data-meadco-server="http://<yourlocaldomain>/<yourOnPremServicesAppName>"> </script>