Using WaitForSpoolingComplete with ScriptX.Addon

Activity log  ::  

Asynchronous Printing

Please note that this page licensed. Restart sample with license

All printing with ScriptX is asynchronous.

Each of the functions Print, PrintHTML and BatchPrintPDF will return immediately after the print request has been started and/or queued with the print occuring on a different thread to the Internet Exploer UI thread. Internet Explorer remains responsive and so the user can close the tab/window while the print is in progress.

However, the owning tab/window must not be closed until the print spooling (sending the data to the printer driver) has been completed. If the tab/window is closed, the print must be abandoned.

If the user tries to close the tab/window while printing is in progress or pending ScriptX will wait 5 seconds for the print to complete. If the print completes, the action then occurs. If the print does not complete in that time ScriptX will display a warning and the user is asked to confirm that the print(s) should be abandoned. If not, the close action is abandoned instead and printing the current document and any queued documents will continue.

The OwnQueue Exception

The exception to the above is when the OwnQueue() function has been called and PrintHtml() or PrintHtmlEx() are used to print. In this case, the printing occurs in a completely separate process and the owner tab/window can be closed and no warning will occur.

Tests should be undertaken with the printer in 'direct' mode (i.e. not spooling) this causes the print to be slower and effects more pronounced.
Default behaviour

These actions illustrate the behaviour of ScriptX printing the current document (i.e. the ubiquitous factory.printing.Print() api) or a remote document (i.e. the factory.printing.PrintHTML() api) without any script code to wait for printing to complete.

Navigate now

WaitForSpoolingComplete

The WaitForSpoolingComplete function enables synchronous javascript code to be written so that actions can be taken safely once all printing has completed. For example; navigate to another page or close the current window.

Note that this is different to changing a document before and after printing. The browser onbeforeprint and onafterprint events should be used for that.

The WaitforSpoolingComplete() function requires a license.

Restart sample with license


Some content to force a longer render time.

ScriptX.Services

ScriptX.Services enables the consistent printed formatting and appearance of browser‑based content. It is our evolving cross‑browser solution, printing across the cloud and to printers connected to individual PC workstations or to on‑premise servers.

Consistent printing with ScriptX.Services

Many of our users told us that they wanted to use ScriptX's unique printing functionality in other browsers and on other platforms and devices.

ScriptX.Services is an evolution which continues to provide developers with the tools to ensure the consistent formatting and appearance of printed output regardless of a user's choice of device or browser. So for example, labels or badges can now be printed from a browser on a smartphone or tablet to a specified printer on an intranet.

To support today's browsers on any device, with ScriptX.Services we take the technology of ScriptX.Add‑on and deploy it behind a web API on a Windows server which can be running on the user's PC, on an intranet or on the public internet “in the Cloud”.

The interface accepts a stream of HTML to print and the settings to use and then passes those onto the print engine, which in turn prints the HTML to the specified or default printer with the settings provided such as headers, footers, margins, printer, paper size and so on. The HTML to be printed could be the current page in the browser but could also be HTML generated by scripting on the page or even HTML from a different URL entirely. Printing of PDF documents is also supported.

Promptless printing - as printing is carried out via the ScriptX.Services API, the browser's print dialog will not be shown, preventing users from inadvertently using settings that prevent a document from printing as intended. Alternatively developers can create their own print dialog using our freely available javascript libraries or hand-crafting a purposed, customised dialog or popup.

Please take a look at our introduction and guide which demonstrates how straightforward it is to incorporate ScriptX.Services into your existing web applications and take control of your printed output. The guide also discusses how existing ScriptX licensees using our MeadCoScriptXJS javascript wrapper library for ScriptX.Add‑on can easily modify their web applications to use ScriptX.Services. Click here for a walk-through illustration of converting a web page.


Consistent printing with ScriptX.Services

Many of our users told us that they wanted to use ScriptX's unique printing functionality in other browsers and on other platforms and devices.

ScriptX.Services is an evolution which continues to provide developers with the tools to ensure the consistent formatting and appearance of printed output regardless of a user's choice of device or browser. So for example, labels or badges can now be printed from a browser on a smartphone or tablet to a specified printer on an intranet.

To support today's browsers on any device, with ScriptX.Services we take the technology of ScriptX.Add‑on and deploy it behind a web API on a Windows server which can be running on the user's PC, on an intranet or on the public internet “in the Cloud”.

The interface accepts a stream of HTML to print and the settings to use and then passes those onto the print engine, which in turn prints the HTML to the specified or default printer with the settings provided such as headers, footers, margins, printer, paper size and so on. The HTML to be printed could be the current page in the browser but could also be HTML generated by scripting on the page or even HTML from a different URL entirely. Printing of PDF documents is also supported.

Promptless printing - as printing is carried out via the ScriptX.Services API, the browser's print dialog will not be shown, preventing users from inadvertently using settings that prevent a document from printing as intended. Alternatively developers can create their own print dialog using our freely available javascript libraries or hand-crafting a purposed, customised dialog or popup.

Please take a look at our introduction and guide which demonstrates how straightforward it is to incorporate ScriptX.Services into your existing web applications and take control of your printed output. The guide also discusses how existing ScriptX licensees using our MeadCoScriptXJS javascript wrapper library for ScriptX.Add‑on can easily modify their web applications to use ScriptX.Services. Click here for a walk-through illustration of converting a web page.


Consistent printing with ScriptX.Services

Many of our users told us that they wanted to use ScriptX's unique printing functionality in other browsers and on other platforms and devices.

ScriptX.Services is an evolution which continues to provide developers with the tools to ensure the consistent formatting and appearance of printed output regardless of a user's choice of device or browser. So for example, labels or badges can now be printed from a browser on a smartphone or tablet to a specified printer on an intranet.

To support today's browsers on any device, with ScriptX.Services we take the technology of ScriptX.Add‑on and deploy it behind a web API on a Windows server which can be running on the user's PC, on an intranet or on the public internet “in the Cloud”.

The interface accepts a stream of HTML to print and the settings to use and then passes those onto the print engine, which in turn prints the HTML to the specified or default printer with the settings provided such as headers, footers, margins, printer, paper size and so on. The HTML to be printed could be the current page in the browser but could also be HTML generated by scripting on the page or even HTML from a different URL entirely. Printing of PDF documents is also supported.

Promptless printing - as printing is carried out via the ScriptX.Services API, the browser's print dialog will not be shown, preventing users from inadvertently using settings that prevent a document from printing as intended. Alternatively developers can create their own print dialog using our freely available javascript libraries or hand-crafting a purposed, customised dialog or popup.

Please take a look at our introduction and guide which demonstrates how straightforward it is to incorporate ScriptX.Services into your existing web applications and take control of your printed output. The guide also discusses how existing ScriptX licensees using our MeadCoScriptXJS javascript wrapper library for ScriptX.Add‑on can easily modify their web applications to use ScriptX.Services. Click here for a walk-through illustration of converting a web page.


Consistent printing with ScriptX.Services

Many of our users told us that they wanted to use ScriptX's unique printing functionality in other browsers and on other platforms and devices.

ScriptX.Services is an evolution which continues to provide developers with the tools to ensure the consistent formatting and appearance of printed output regardless of a user's choice of device or browser. So for example, labels or badges can now be printed from a browser on a smartphone or tablet to a specified printer on an intranet.

To support today's browsers on any device, with ScriptX.Services we take the technology of ScriptX.Add‑on and deploy it behind a web API on a Windows server which can be running on the user's PC, on an intranet or on the public internet “in the Cloud”.

The interface accepts a stream of HTML to print and the settings to use and then passes those onto the print engine, which in turn prints the HTML to the specified or default printer with the settings provided such as headers, footers, margins, printer, paper size and so on. The HTML to be printed could be the current page in the browser but could also be HTML generated by scripting on the page or even HTML from a different URL entirely. Printing of PDF documents is also supported.

Promptless printing - as printing is carried out via the ScriptX.Services API, the browser's print dialog will not be shown, preventing users from inadvertently using settings that prevent a document from printing as intended. Alternatively developers can create their own print dialog using our freely available javascript libraries or hand-crafting a purposed, customised dialog or popup.

Please take a look at our introduction and guide which demonstrates how straightforward it is to incorporate ScriptX.Services into your existing web applications and take control of your printed output. The guide also discusses how existing ScriptX licensees using our MeadCoScriptXJS javascript wrapper library for ScriptX.Add‑on can easily modify their web applications to use ScriptX.Services. Click here for a walk-through illustration of converting a web page.


Consistent printing with ScriptX.Services

Many of our users told us that they wanted to use ScriptX's unique printing functionality in other browsers and on other platforms and devices.

ScriptX.Services is an evolution which continues to provide developers with the tools to ensure the consistent formatting and appearance of printed output regardless of a user's choice of device or browser. So for example, labels or badges can now be printed from a browser on a smartphone or tablet to a specified printer on an intranet.

To support today's browsers on any device, with ScriptX.Services we take the technology of ScriptX.Add‑on and deploy it behind a web API on a Windows server which can be running on the user's PC, on an intranet or on the public internet “in the Cloud”.

The interface accepts a stream of HTML to print and the settings to use and then passes those onto the print engine, which in turn prints the HTML to the specified or default printer with the settings provided such as headers, footers, margins, printer, paper size and so on. The HTML to be printed could be the current page in the browser but could also be HTML generated by scripting on the page or even HTML from a different URL entirely. Printing of PDF documents is also supported.

Promptless printing - as printing is carried out via the ScriptX.Services API, the browser's print dialog will not be shown, preventing users from inadvertently using settings that prevent a document from printing as intended. Alternatively developers can create their own print dialog using our freely available javascript libraries or hand-crafting a purposed, customised dialog or popup.

Please take a look at our introduction and guide which demonstrates how straightforward it is to incorporate ScriptX.Services into your existing web applications and take control of your printed output. The guide also discusses how existing ScriptX licensees using our MeadCoScriptXJS javascript wrapper library for ScriptX.Add‑on can easily modify their web applications to use ScriptX.Services. Click here for a walk-through illustration of converting a web page.