UnForm processes jobs in a complex but defined manner. The following list describes in general what occurs when a job is submitted:
The client program is executed with options, generally including input and output specifications, a rule file, and any other command line arguments. On UNIX, it is possible for the input and/or the output to be "standard input" and "standard output", so that the client can process jobs in a pipe. Here are a few examples:
uf90c –i sample1.txt –o ">lp –dlaser –oraw" –f acme.rul
cat sample1.txt | uf90c | lp –dmylaser –T pcl
cat sample1.txt | uf90c –p pdf >/home/mypdfs/xyz.pdf
uf90c –i sample1.txt –o client:myfile.pdf –p pdf
In all cases, the input file comes from the client and is sent to the server. With a –o option, the output normally stays on the server, though if the output designation is prefixed with "client:", then it is returned to the client. On UNIX, if "standard output" is designated, the output is also returned to the client. The rule file specified with the –f option resides on the server.
For performance reasons, it is normally desirable to specify a server-based output designation with the -o option. In that circumstance, the client only runs long enough to submit the job and ensure the command line arguments are acceptable to the server, then returns to the application. If the client will be receiving the output, it must wait for the job to finish and retrieve it, which can be time consuming (though certainly less so if the client and server are on the same machine).
When the server receives the job, it stores the input in a temporary file, and calls the UnForm processor to handle the job.
UnForm reads the input file to obtain the first page. It looks for a form-feed, or if no form-feed is found, it reads the first 255 lines. It then strips the data of any PCL escape sequences in order to get a plain text array of lines. Lines must be terminated with line-feed characters (ASCII 10), carriage-returns characters (ASCII 13), or carriage-return, line-feed sequences (ASCII 13, 10).
Note that if the input is found to be PostScript, then UnForm processes the job using UnForm AFO.
This first page is processed against the rule file. If a –r ruleset command line argument was used, then the rule file is scanned for the specified rule set. Otherwise, each rule set's detect statements are tested using the first page of text. When the rule set is found, it is parsed into commands and code blocks. If no rule set is found, then the job is handled by pass-through logic, or if a rule set was specified with –r and not found, an error occurs and the job exits.
If the parsed rule set indicates a page size with the page n command, any excess lines read from the first page are returned to the input buffer. As the input stream is read for additional pages, UnForm will read only n lines per page. Note that if a form-feed character is encountered before n lines have been read, then the page is also considered complete.
If a prejob code block is present, it is executed.
Now processing of the job begins. Each page is processed in the following order:
• | The prepage code block is executed. |
• | Any command expression values are resolved. |
o | The precopy code block is executed. |
o | Command expressions are resolved. |
o | Any hshift or vshift commands are executed (if shiftfirst=1 in ufparam.txt [defaults]). |
o | Move commands are executed. |
o | Font, bold, italic, underline, and light commands are executed. |
o | Shade commands are executed. |
o | Box commands are executed. |
o | Text commands are executed. |
o | Hline and vline commands are executed. |
o | Erase commands are executed. |
o | Any hshift or vshift commands are executed (if shiftfirst=0 in ufparam.txt [defaults]) |
o | Attach commands are executed. |
o | Image commands are executed. |
o | Barcode commands are executed. |
o | The application text, with any font attributes applied, is added. |
o | Micr commands are executed. |
o | The postcopy code block is executed.
|
• | The postpage code block is executed. |
• | When all pages have been processed, the postjob code block is executed. |
• | As the job is processed, the output designation for each copy is checked, and if the output is changed, predevice and postdevice code blocks are executed. When running a PDF job, the only time the output can be changed is in the prejob code block, or with an output command that is non-copy specific. The postdevice code block is executed after the output is complete and closed, making it suitable for handling the output file itself (for emailing, faxing, etc.). |
Once the job is complete, it is available to return to the client, if the client's command line requires it. The client has monitored the job for completion in that case, and it then retrieves the job output. Note that if the rule set has overridden the output designation for the job, or part of the job, then the client will only be able to retrieve what was sent to the original output designation.
So the following scenario will conflict:
• | uf90c –i sample1.txt –o client:/tmp/invoice.pdf –f advanced.rul –r invoice |
• | In the invoice ruleset is this: output "/home/pdfs/invoice.pdf" |
• | The server will send output to its /home/pdfs/invoice.pdf file, leaving the temporary output for the client empty. The client /tmp/invoice.pdf file will be an invalid, empty file. |
|