Difference between revisions of "Setting up a VISTA Printer"

From VistApedia
Jump to: navigation, search
 
Line 28: Line 28:
 
         ;"        printing system.
 
         ;"        printing system.
 
         ;"Output: Returns name of file to put output into
 
         ;"Output: Returns name of file to put output into
 
+
       
 
         ;"UNIQUE will generate a filename based on time and job number
 
         ;"UNIQUE will generate a filename based on time and job number
 
         ;"    i.e. 'Print-Job-628233034.tmp
 
         ;"    i.e. 'Print-Job-628233034.tmp
 
+
       
 
         ;"write !,"here in GETJOBNM^TMGPRNTR",!
 
         ;"write !,"here in GETJOBNM^TMGPRNTR",!
 
         new cJobs set cJobs="PRINT JOBS"
 
         new cJobs set cJobs="PRINT JOBS"
 
         new Filename set Filename=$$UNIQUE^%ZISUTL("/tmp/Print-Job.tmp")
 
         new Filename set Filename=$$UNIQUE^%ZISUTL("/tmp/Print-Job.tmp")
 
+
       
 
         ;"Now store Filename for later transfer to Linux lpr
 
         ;"Now store Filename for later transfer to Linux lpr
 
         new index set index=$order(^TMP("TMG",cJobs,$J,""))
 
         new index set index=$order(^TMP("TMG",cJobs,$J,""))
 
         if index="" set index=1
 
         if index="" set index=1
 
         set ^TMP("TMG",cJobs,$J,index)=Filename
 
         set ^TMP("TMG",cJobs,$J,index)=Filename
 
+
       
 
         ;"write !,"Print job name will be:",Filename,!
 
         ;"write !,"Print job name will be:",Filename,!
 
         quit Filename  ;"result returned by altering Filename
 
         quit Filename  ;"result returned by altering Filename
Line 51: Line 51:
 
         ;"      done (option -r)
 
         ;"      done (option -r)
 
         ;"Input: Printer OPTIONAL -- the name of the linux printer to send the job to.
 
         ;"Input: Printer OPTIONAL -- the name of the linux printer to send the job to.
 
+
       
 
         new cJobs set cJobs="PRINT JOBS"
 
         new cJobs set cJobs="PRINT JOBS"
 
         new index set index=$order(^TMP("TMG",cJobs,$J,""))
 
         new index set index=$order(^TMP("TMG",cJobs,$J,""))
 
         new Filename set Filename=$get(^TMP("TMG",cJobs,$J,index))
 
         new Filename set Filename=$get(^TMP("TMG",cJobs,$J,index))
 
+
       
 
         close IO
 
         close IO
 
         kill IO(1,IO)
 
         kill IO(1,IO)
 
+
       
 
         kill ^TMP("TMG",cJobs,$J,index)
 
         kill ^TMP("TMG",cJobs,$J,index)
 
         if Filename'="" do
 
         if Filename'="" do
Line 69: Line 69:
 
         . zsystem CmdStr
 
         . zsystem CmdStr
 
         . ;"write "Back from zsystem.  Returning to Fileman.",!
 
         . ;"write "Back from zsystem.  Returning to Fileman.",!
 
+
       
 
         quit
 
         quit

Revision as of 15:25, 10 June 2005

Here is my DEVICE file entry:

OUTPUT FROM WHAT FILE: TIU DOCUMENT// device (66 entries) Select DEVICE NAME: s121-LAUGHLIN-LASER Laughlin_Office <TO BE SET IN P RE-OPEN EX.> ANOTHER ONE: STANDARD CAPTIONED OUTPUT? Yes// (Yes) Include COMPUTED fields: (N/Y/R/B): NO// b BOTH Computed Fields and Record Num ber (IEN)

NUMBER: 65 NAME: S121-LAUGHLIN-LASER

 $I: <TO BE SET IN PRE-OPEN EX.>       LOCATION OF TERMINAL: Laughlin_Office
 SUPPRESS FORM FEED AT CLOSE: YES      NEAREST PHONE: 787-7000
 PAGE LENGTH: 70                       FORM CURRENTLY MOUNTED: Plain paper
 POST-CLOSE EXECUTE: DO FINISH^TMGPRNTR("laughlin_laser")
 PRE-OPEN EXECUTE: SET IO=$$GETJOBNM^TMGPRNTR()
 SUBTYPE: P-OTHER80                    TYPE: HOST FILE SERVER




GETJOBNM()
       ;"Purpose: To create a unique printer job name.  
       ;"        This will be used during a printing process
       ;"        that writes the printer file to the host file system, 
       ;"        then passes file to Linux
       ;"        printing system.
       ;"Output: Returns name of file to put output into
       
       ;"UNIQUE will generate a filename based on time and job number
       ;"    i.e. 'Print-Job-628233034.tmp
       
       ;"write !,"here in GETJOBNM^TMGPRNTR",!
       new cJobs set cJobs="PRINT JOBS"
       new Filename set Filename=$$UNIQUE^%ZISUTL("/tmp/Print-Job.tmp")
       
       ;"Now store Filename for later transfer to Linux lpr
       new index set index=$order(^TMP("TMG",cJobs,$J,""))
       if index="" set index=1
       set ^TMP("TMG",cJobs,$J,index)=Filename
       
       ;"write !,"Print job name will be:",Filename,!
       quit Filename   ;"result returned by altering Filename


FINISH(Printer)
       ;"Purpose: to complete the printing process by sending the now-created file
       ;"        to Linux CUPS (the printing system).
       ;"Note: The lpr system itself will delete this print file when 
       ;"      done (option -r)
       ;"Input: Printer OPTIONAL -- the name of the linux printer to send the job to.
       
       new cJobs set cJobs="PRINT JOBS"
       new index set index=$order(^TMP("TMG",cJobs,$J,""))
       new Filename set Filename=$get(^TMP("TMG",cJobs,$J,index))
       
       close IO
       kill IO(1,IO)
        
       kill ^TMP("TMG",cJobs,$J,index)
       if Filename'="" do
       . new CmdStr
       . set CmdStr="lpr "
       . if $get(Printer)'="" set CmdStr=CmdStr_"-P "_Printer
       . ;"option -r --> lpr deletes file after printing done.
       . set CmdStr=CmdStr_" -r "_Filename_" &"
       . ;"write !,"Here is where I call:",!,"ZSYSTEM "_CmdStr,!
       . zsystem CmdStr
       . ;"write "Back from zsystem.  Returning to Fileman.",!
       
       quit