ScriptX.Services is for use within web applications within any browser. The use of ScriptX.Services provides scripted control of a printing experience within the browser including allowing a choice of the output printer, orientation, page header and footers etc and the initiation of printing.
ScriptX.Services is our evolution to providing developers with the tools for ensuring the consistent formatting and appearance of printed output regardless of the users device or modern browser.
For example, maintain investment in current code:
or, modern code with no external modules/libraries:
This is the output from our cloud service `printing` using a print to PDF print driver.
The result is output with consistent formatting and appearance regardless of the browser and its settings that you are using.
The same idea works with ScriptX.Services hosted not in the cloud but on your own network or on each individual Windows PC and you can print to paper/labels from any browser to any printer available on the network / PC.
ScriptX.Services product options:
The closest equivalent to the ScriptX Add‑on for Internet Explorer, the Microsoft Windows (x64) PC service provides for ‘printing’ to any print device available to the client Microsoft Windows (x64) PC.
Each user must install ScriptX.Services on their Windows PC. Content can then be printed from any modern browser or Internet Explorer 11.
Current ScriptX.Add-on client licenses will work with ScriptX.Services for Windows PC and there is a reasonable migration path to update current scripts that work with the Add-on to work with ScriptX.Services for Windows PC.
The on-premise ScriptX.Services is completely under your own control hosted on your own Microsoft Windows (x64) Server and provides for ‘printing’ to any print device available to the server.
We provide a migration path for all current licensees.
Our FREE cloud service provides for ‘printing’ to a PDF or XPS format file which is downloaded by the user. They may open, save or print the file - think of this as an easy way to provide a “download this page as a PDF/XPS document” facility on your website.
This service is available now at no cost but is subject to a fair-use policy. Click here to sign up for your free cloud service acccount.
ScriptX.Add-on for Internet Explorer uses a deep integration with the Internet Explorer UI and custom templates for the Trident Print engine within Internet Explorer. This enables the Internet Explorer engine to be used to paginate the document and render to the print output device.
The add-on needs to be installed on each client PC - a process that in general requires Administrator privileges and for advanced usage requires a license is accepted and installed by each user of Internet Explorer.
To control the print process the developer writes script code to set required properties on and call methods from the add-on to perform printing and other tasks. Typically the add-on was instantiated with the id 'factory' so code such as this is typical:
As well as working within Internet Explorer we developed ScriptX so that it could be used as an HTML print engine for applications and services such as Internet Information Services (IIS).
In other words, the print technology of ScriptX is tried, tested and used over many years to prove its reliability and robustness.
To support modern browsers on any device with ScriptX.Services we take that technology and deploy it behind a rich Web API on a local web server that provides the interface between the ScriptX print engine on the PC and the client devices.
The interface accepts a stream of html to print and the settings to use and then passes those onto the print engine which then prints the html with the provided settings such as headers, footers, margins, printer to use, papersize to use and so on.
So, instead of the printing being performed within and by the user's browser, the content to be printed is sent from user's browser to ScriptX.Services where it is paginated and rendered to a print device connected to the ScriptX.Services host - the local PC, team server or cloud.
The library will work with both
'.factory' based code and with MeadCoScriptXJS Library based code.
Our ScriptX.Services client libraries support Edge, Chrome, Firefox and Safari (and any modern evergreen browser that supports HTML 5 and ECMAScript 5 or later).
ScriptX.Add-on for Internet Explorer continues to be supported for Internet Explorer.
ScriptX.Add-on provides three three ways of printing HTML content from the browser. Each of these functions prints a 'snapshot' of the content as currently displayed in the browser. ScriptX.Services supports each print function.
Print the page/document
window.factoryobject that fully emulates ScriptX.Add-on.
<script src="/scripts/meadco-core-1.11.0.js"></script> <script src="/scripts/meadco-scriptxprint-1.11.0.js"></script> <script src="/scripts/meadco-scriptxprinthtml-1.11.0).js"></script> <script src="/scripts/meadco-scriptxfactory-1.11.0.js"></script> <script src="/scripts/meadco-scriptxprintlicensing-1.11.0.js"></script> <script src="/scripts/meadco-secmgr-1.11.0.js" data-meadco-license="e29212c9-3c6f-41ac-8078-4596738fdb59" data-meadco-license-revision="0" data-meadco-license-path="warehouse" data-meadco-server="http://127.0.0.1:41191"> </script>
To be clear; when the 'Print(false)' function executes, the html as displayed on screen is sent to the local web server along with references to required external resources such as style sheets and images (script references are not sent). The html document is then paginated and rendered.
The settings such as header and footer are not sent with each setting of a property. The values are stored in variables on the client and then sent to the server with the stream of html to print.
Print a remote document
To print a remote document is simple - send the url to be downloaded and printed to the local web server along with the required settings. In otherwords, instead of the stream to print, just the url. The server then requests the HTML content from the url then it is paginated and rendered.
Print document fragments
[aka factory.SetPageRange(); factory.Print()]
The SetPageRange() function sets a flag such that only the content that is selected (either programmatically or by the user) is printed. The requirement for a selection means this is not hugely useful, but the ability to print a fragment of or part of the current html document or even a dynamically generated document fragment without the need to copy it into the DOM is useful.
With ScriptX.Services we can easily do this by taking a snap shot of part of the DOM rather then the whole page DOM when printing the whole document. The html is sent along with references to required external resources such as style sheets and images (script references are not sent). The html is then assembled as a complete document, paginated and rendered.
With our ScriptX.Services libraries you can write the code that works seemlessly with both the ScriptX.Add-on and ScriptX.Services. Whichever browser, which ever device, which ever version of ScriptX, your users will get the same experience with consistent output.
To write once, leave the ScriptX.Add-on object on the page and add the script files. In those browseers that support ScriptX.Add-on it will be used, in those browsers that don't the emulation will be used:
A chance to re-write is always welcome and the very flat properties/methods list of the add-on isn't the design approach that would be taken now.
Our service exposes a rich API for describing the parameters to use on the print and delivering the HTML content to print.
- plain text headers and footers,
- landscape or portrait orientation of the paper.
- choosing the paper size to use,
- monitoring of job progress,
- full html headers and footers,
- advanced print scaling.
If you are starting new projects now, then you might want to use your preferred library - jQuery, Angular, React, Vue, Axios etc etc to provide the library for calling a REST API and then extract relevant portions from our libraries on ScriptX.Services Client Library for extracting the HTML to send to the rich API.
The choice is yours.
Advantages of ScriptX.Services
- Modern browser independence; the host browser and device is not used to to print, print occurs at a server.
- Consistent output whatever the client browser. A single print engine is used at the server so the results will always be the same.
Disadvantages / Issues
At this time we are using the Internet Explorer 11 Trident Rendering engine in 'edge' mode. This is a highly capabable mode with a high degree of compatibility with modern standards HTML as might be required to be printed but clearly there will be some content that cannot be printed or will appear incorrect if it is not supported by Internet Explorer 11 in standards mode.
At this time, referenced content from a page such as style sheets and images that are inaccessible to the anonymous printing process cannot be obtained and used during printing.
For example, consider you are using a website behind a firewall (or localhost) and use the Cloud Printing Service. The HTML to print is sent to the service along with style sheet references that are relative to the original document and/or image sources that are relative to the original document. ScriptX.Services will not be able to access this content. The result is that the html is printed but no style is applied and the images will be missing.
Similarly, the same problem wil arise when using ScriptX.Services for On Premise Devices or ScriptX.Services for Windows PC and content such as stylesheets and images referenced by the HTML to be printed is protected from anonymous access. This protection may be in the form of authentication, or CORS (for example, browsers perform CORS checking on font .woff files).
At this time, the workaround for this issue is to allow anonymous access / enable CORS to these resources.