Basic Use :: Print and Preview

When using a printing utility the obviously fundamental feature is starting a print or preview of the content to be printed.

The basic set of features of ScriptX include the print or preview of the current document or any of its frames.

To print, we require the ScriptX factory object ([PATH_TO_INSTALLER] is the location of the file on your server):

<object codebase="[PATH_TO_INSTALLER]#Version=8,1,0,2" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" id="factory">

The user might use the gear menu or right client menu to print but it is more helpful to include the UI on the page:

CSS styling will hide this UI from the print ...
<div class="panel hidden-print panel-default">
    <div class="panel-heading">CSS styling will hide this UI from the print ...</div>
    <div class="panel-body">
        <button type="button" class="btn btn-default btn-print" id="btn-print">Print ...</button>
        <button type="button" class="btn btn-default btn-print" id="btn-preview">Preview ...</button>

We include a helper library that will hide browser and version differences and wraps some common tasks in easy to use functions. The library can be found on Nuget and Github.

<script src="/Scripts/meadco-scriptx-1.4.0.js"></script>

And finally we glue everything together with simple script using jQuery:

<script type="text/javascript">
// SetupPrint
// Initialise print attributes, will be reset when the document closes.
function SetupPrint() {
    with (MeadCo.ScriptX.Printing) {
        header = "Print and Preview";
        footer = "&D&b&b&p of &P";
        orientation = "landscape";
$(window).on('load', function() {
    if (MeadCo.ScriptX.Init()) {
        $("#btn-print").click(function() {
        $("#btn-preview").click(function () {
    } else {
        $(".btn-print").prop("disabled", true);


A ScriptX license enables printing any arbritary html document whether dowloaded from a server or dynamically created in script. It can also enable printing PDF format files and printing to label printers using control sequences sent directly to the printer.