nQ Dynamic Document Formatter and TCP/IP
ppnq.htm rev 1.2
June 2002.
© RedTitan technology 2001-2010
This document describes how you can set-up the Dynamic Document Formatter run time system (PrePrinter) in the nQ environment.

nQ lets you remotely control the Dynamic Document Formatter and the RedTitan Spooler from a simple browser interface - (IE5+ is recommended). Used in conjunction with the nQLPD spooler, data is transferred to the formatting system complete with appropriate job ticketing information. DDF merges graphics, static overlays and dynamically composes text and creates output in a number of printer formats (PDL). If you do not have the nQ icon on the taskbar like this you must first install nQ.
nQ Dynamic Document Formatter - Installation and setup 1
My nQ is installed on the PC IP address 195.72.138.22 on Port 5002 - Your URL will be different. The next step is to make sure we always have the RedTitan Spooler running on this system. Select Setup from the PROGRAMS tab.
nQ Dynamic Document Formatter - Installation and setup 2
If you do not have an entry that looks like this add one at the end of the table. Click Apply to confirm your changes. This entry will be added to the new folder on the PROGRAMS tab. __\ is a shorthand for the nQ software directory - That is (_)underscore (_) underscore (\)backslash. If you check the Auto box then NQLPD.EXE will be launched at system start up.

It is important to have the NQLPD spool always available. The spool acts as a safe place for data and print files. NQLPD uses a rule table to process files in the spool but the system will wait until a target resource becomes available.
nQ Dynamic Document Formatter - Installation and setup 3
Next we have to configure the spooler - Select the SPOOL tab and choose Configure. The Printers check box is important. This means that folders may be created automatically. Remember you must stop the spooler from the PROGRAMS tab to install a new rules table. If you have got this far you might like to try sending a file from a remote host to the spooler. You could us an NT LPR client e.g.
  LPR -PXFOLDER -S195.72.138.22 example.txt
This may create a new folder called c:\spool\xfolder containing a control file and a data file.
nQ Dynamic Document Formatter - TCP/IP service If you need help understanding TCP/IP try the DOS window command NETSTAT with the "a" switch.
C:\jmm>netstat -a

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    ALTONTOWER:printer     ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:ftp         ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:135         ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:5002        ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:1025        ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:1075        ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:1119        ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:137         ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:138         ALTONTOWER:0           LISTENING
  TCP    ALTONTOWER:nbsession   ALTONTOWER:0           LISTENING
  UDP    ALTONTOWER:1075        *:*
  UDP    ALTONTOWER:1119        *:*
  UDP    ALTONTOWER:nbname      *:*
  UDP    ALTONTOWER:nbdatagram  *:*

C:\jmm>

The nQ system is running two TCP/IP services ALTONTOWER:ftp and ALTONTOWER:5002 (An advanced HTTP service) ALTONTOWER is the IP address on 195.72.138.22. The program NQLPD is running the ALTONTOWER:printer service. These LISTENING services can accept a number of connections from "client" programs. e.g. ALTONTOWER:printer can accept multiple connections from remote client LPR programs. By convention, different protocols are offered on specially numbered ports. The "printer" port is number 515. You can find a complete list of port numbers in the services file. Only ONE service can listen on each port.
C:\WINDOWS>dir services.

 Volume in drive C is ALTONTOWER
 Volume Serial Number is 3C27-17F8
 Directory of C:\WINDOWS

SERVICES             6,032  13/04/00   9:05 SERVICES
         1 file(s)          6,032 bytes
         0 dir(s)        1,843.63 MB free

C:\WINDOWS>
All RedTitan transform programs (EscapeE, RedPrint, nDP etc.) will accept data from TCP/IP. The PrePrinter will accept TCP/IP connections on the PREPRINTER port. To be safe (to avoid a conflict) we must next edit the SERVICES file to add the preprinter port number. Choose an unused high number like 5056. e.g.
preprinter 5056/tcp
nQ Dynamic Document Formatter - PrePrinter/DDF
Now we can test the PrePrinter. The PP command FROM TCP can be used in place of the FROM PATH command to start PP listening on the preprinter port.
nQ Dynamic Document Formatter - TCP/IP testing 1 We could go right ahead and install a spooler forwarding rule but to give us some confidence try connecting to PP using telnet. The command is :-
C:\WINDOWS>telnet 195.72.138.22 preprinter

C:\WINDOWS>
If the TELNET title bar looks like this then PP has accepted your connection. You may need to change Terminal Preferences to get local echo. Try a couple of prefixed commands like these. View the PP log window to see the activity. This should work from any host in the network.
nQ Dynamic Document Formatter - Rule table
Now choose Edit rules on the SPOOL tab. Click on the icon y to insert a new rule. Create a rule that looks something like this. The STARTS and ENDS actions must be added before the TELNET action.
The STARTS action is intended to add a JOB TICKET to a PrePrinter data stream - LPRC is a formal parameter that gets substituted by the actual CLASS parameter of any job in folder(printer) called "ppfolder".
In the following LPR example, the notation !!LPRC; is replaced by the actual Class parameter of the job r1.
e.g.
  LPR -Pppfolder -S195.72.138.22 -Cr1 example.pp
The job ticket added to the data file is (*PRE*)JOB STREAM=Nr1

There is more information on the parameters that are available in here.
When editing rule tables take great care not to create a loop and only refer to IP address that are running the appropriate service. The View console link on the SPOOL tab will help you follow the processing of the spooler rules. Remember - You need to stop and re-start the nqlpd spool to engage the new rule table.
nQ Dynamic Document Formatter - LPR support The DDF/PrePrinter will also act as an LPR client. Here is a complete PP command file.
  JOB MODE=HP,QUEUE=XTEST,LPRC=MYCLASS,LPR=195.72.138.22
  FORMAT %PP will support LPRN, LPRJ, LPRC, LPRL, LPRP, 
  FORMAT % LPRH job ticket parameters
  BREAK
  PAGE
  EOJ
PP uses the QUEUE job ticket switch to specify the printer folder name. (the DOS LPR client -P switch)
The parameter substitution features of the STARTS action will let you dynamically build a job ticket for the PrePrinter that will LPR the completed job back to the spool with sufficient information for a new rule to be able to forward the job to the final destination. The spooler will wait until the job is completed and keep status information. The data file is deleted when the action is complete. nQ Dynamic Document Formatter - summary In these examples we have used the IP address 195.72.138.22. In your tests you must specify your own IP address. The utility IPCONFIG may help. If you wish to experiment on a single host PC use the IP loop back address 127.0.0.1 The rule table is in XML format - NQRULES.XML. The rule table wizard pages are based on the XSL transform NQRULES.XSL. With care you may edit the XML directly.
© Redtitan Technology 1998, 1999, 2001, 2002, 2003, 2004