Skip to Content

How do you handle printing from the WebClient?

Estimated Reading Time: 2 Minutes

There are four options for printing in WebClient:

  • from the WebClient to the browser in a separate tab
  • from the WebClient to the client's download folder
  • from the WebClient to a server printer
  • from the Application Server to a server printer

Printing to the client's browser window:
The WebClient's default printing method follows a user's familiar experience when accessing a document from the web browser.
If you print to "-P SPOOLER" the document will open in a new page of the browser as a pdf document, and the user will be given the option to print.

Downloading to the client's download folder:
If you print to "-P PDF" the document will be put onto the WebClient server, and you can use C$EASYOPEN or C$DESKTOP to move the document to the client machine, where it will download within the browser to the download folder set up in the browser settings.

We often get asked how to print a page directly to the client's printer. This isn't possible from the WebClient, because executing client processes and accessing client resources from a browser is a security risk and blocked by all browsers. The Application Server communicates with the browser, not directly with the user.
However, it's common practice for a web user to click on a request to print a document from a web page, and see that document either displayed on a separate tab as a PDF document or downloaded. The user is used to clicking on the print button at this point.
Attached is a sample program that shows the difference between option #1 (opening a document in a new browser window) and #2 (downloading it as a pdf to the users' desktop).

If you want to print to a printer installed on the server where the WebClient is running, you have two options. Note however that the client's local printers are not available unless those printers are also installed on the WebClient's server.

Printing from the WebClient server:
In the WebClient console's configuration window, one of the last options available is "Allow Server Printing". If you turn this on, the program can print to any printer installed on the WebClient process's server.

Application Server to a server printer:
The last WebClient printing option is to bypass the WebClient completely, and handle the printing from the Application Server.

    set wprt-as-server to true
    call "WIN$PRINTER" using winprint-set-printer-as 
                             winprint-as
The printers on the Application Server's server are available with this option. You can see more code to handle this type of printing in our ISCONTROLSET sample:
   %ISCOBOL%/sample/iscontrolset/PRINTGUI.cbl

How do you handle printing from the WebClient?
  • Attached Files
  • webcprint.zip (8.4 KB) 19