Difference between revisions of "Setting up a VISTA Printer"

From VistApedia
Jump to: navigation, search
m
Line 9: Line 9:
 
   SUPPRESS FORM FEED AT CLOSE: YES   
 
   SUPPRESS FORM FEED AT CLOSE: YES   
 
                   PAGE LENGTH: 70                   
 
                   PAGE LENGTH: 70                   
      FORM CURRENTLY MOUNTED: Plain paper
+
            PRE-OPEN EXECUTE: SET IO=$$GETJOBNM^TMGPRNTR()
 
           POST-CLOSE EXECUTE: DO FINISH^TMGPRNTR("laughlin_laser")
 
           POST-CLOSE EXECUTE: DO FINISH^TMGPRNTR("laughlin_laser")
            PRE-OPEN EXECUTE: SET IO=$$GETJOBNM^TMGPRNTR()
 
 
                       SUBTYPE: P-OTHER80           
 
                       SUBTYPE: P-OTHER80           
 
                         TYPE: HOST FILE SERVER
 
                         TYPE: HOST FILE SERVER
Line 78: Line 77:
 
Here is another, more bare bones DEVICE to print from GT.M.
 
Here is another, more bare bones DEVICE to print from GT.M.
  
 +
It's running on an Ubuntu Linux system with CUPS.
  
  
Line 88: Line 88:
 
                   TYPE: HOST FILE SERVER
 
                   TYPE: HOST FILE SERVER
  
It's running on an Ubuntu system with CUPS.
+
 
 +
 
  
 
--[[User:JohnLeoZ|gra'pa Z]] 00:38, 12 Sep 2006 (CDT)
 
--[[User:JohnLeoZ|gra'pa Z]] 00:38, 12 Sep 2006 (CDT)

Revision as of 05:43, 12 September 2006

Back to Programming VistA Issues


Here is my DEVICE file entry:

                        NAME: S121-LAUGHLIN-LASER
                          $I: <TO BE SET IN PRE-OPEN EX.>    
        LOCATION OF TERMINAL: Laughlin_Office
 SUPPRESS FORM FEED AT CLOSE: YES   
                 PAGE LENGTH: 70                   
            PRE-OPEN EXECUTE: SET IO=$$GETJOBNM^TMGPRNTR()
          POST-CLOSE EXECUTE: DO FINISH^TMGPRNTR("laughlin_laser")
                     SUBTYPE: P-OTHER80          
                        TYPE: HOST FILE SERVER



Here is the supporing files that create a file for writing, and then send the output file to the Linux lpr system


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
 


Here is another, more bare bones DEVICE to print from GT.M.

It's running on an Ubuntu Linux system with CUPS.


                  NAME: PRINTSERVER                      
                    $I: /tmp/vistaprint.txt
  LOCATION OF TERMINAL: lpr           
            OPEN COUNT: 1
    POST-CLOSE EXECUTE: X "ZSYSTEM ""lpr -r /tmp/vistaprint.txt"""
               SUBTYPE: P-OTHER80                 
                  TYPE: HOST FILE SERVER



--gra'pa Z 00:38, 12 Sep 2006 (CDT)