sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Printing IFS documents on network printers

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing IFS documents on network printers

    We store our invoices in .pdf format on our IFS. We generally email them out using MMAIL from here, but we'd also like to setup a job to print hard copies of a late notice as well as any related invoices. Both documents would be stored in the IFS.

    TIA.
    Your friends list is empty!

  • #2
    Re: Printing IFS documents on network printers

    Hey,

    I have a PC that is connected to the box and always signed on to it. I use it to do similar automated functions. use a network share and then you can do it with ease.

    As far as printing it from the 400. there is a way. Search the API books online.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Printing IFS documents on network printers

      You could use the rfile command through QSH.

      Pete

      Comment


      • #4
        Re: Printing IFS documents on network printers

        Pete Who knew



        ISERIES PROGRAMMER TIPS
        Printing from Qshell

        Shalom Carmel
        03.16.2006
        While Qshell is a valuable tool in the iSeries professional's toolbox, some features it has are hard to discover. For example, instructions on how to print Qshell output to an iSeries printer are hidden in an obscure page in the InfoCenter. To send the output of a Qshell command to an output queue, use the Rfile command. Entered by itself, the following command "echo Hello iSeries" will echo to the screen the words "Hello iSeries". We will redirect that to a printer file via Rfile echo Hello iSeries | Rfile -wbQ -c "ovrprtf file(qprint) outq(outqname) splfname(qshprt) hold(*yes)" qprint

        The InfoCenter has an example on how to send ASCII files and Qshell output to remote printers.
        more...

        1. Print the spool file named QPRINT and number 1 for a job using a qualified job name. catsplf -j 386687/SHELLTST/QZSHCHLD QPRINT 1
        2. Print the spool file named QPRINT and number 1 for a job using a pid. catsplf -p 942 QPRINT 1
        3. Print all of the spool files for a job. catsplf -a -j 386687/SHELLTST/QZSHCHLD


        and more
        PHP Code:
        STRQSH
        before='ovrprtf qprint devtype(*userascii) spool(*yes)'
        after="lpr file(qprint) rmtsys(printserver) prtq (printername) transform(*no)"
        cat -/qibm/userdata/mydir/mypdf.pdf Rfile -wbQ -"$before-"$afterqprint 
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Printing IFS documents on network printers

          From my PC I can run this command ...

          Code:
          AcroRd32.exe /t "\\ifs\invoices\INV3103646.pdf" "\\172.16.0.5\ricoh3045"

          I guess I'll have to play around with that and STRPCCMD?



          Sorry ... typed this at the same time as your post Jamie!
          Last edited by mjhaston; October 6th, 2009, 12:17 PM.
          Your friends list is empty!

          Comment


          • #6
            Re: Printing IFS documents on network printers

            Code:
            > before='ovrprtf qprint devtype(*userascii) spool(*yes)'                                                                 
              $                                                                                                                       
            > after="lpr file(qprint) rmtsys(my-iseries-ip) prtq(ricoh3045) transform(*no)"                                             
              $                                                                                                                       
            > cat -c /invoices/INV3103646.pdf | Rfile -wbQ -c "$before" -C "$after" qprint                                            
              Rfile: 001-2354 Message CPF0006 running CL command lpr file(qprint) rmtsys(my-iseries-ip) prtq (ricoh3045) transform(*no)  
              $
            Your friends list is empty!

            Comment


            • #7
              Re: Printing IFS documents on network printers

              I hate to bump a slightly over year-long thread, but I'm pretty much attempting to do the same thing mjhaston is here - printing a PDF stored in the IFS to a network attached printer. I feel like perhaps I'm missing a step here somewhere, however.

              I'm able to run the following, and have output show up in

              PHP Code:
              echo Hello iSeries Rfile -wbQ -"ovrprtf file(qprint) outq(BP4) splfname(pdfprt) hold(*yes)" qprint 
              However, trying to modify the second example ends up with a file that I can't release to the printer - it just flashes back to *HLD immediately.

              PHP Code:
              before='ovrprtf qprint devtype(*userascii) spool(*yes)'                                                                 
              after="lpr file(qprint) rmtsys(my-iseries-ip) prtq(BP4) transform(*no)"                                             
              cat -/01.pdf Rfile -wbQ -"$before-"$afterqprint 
              My gut feeling at this point is something to do with how the printer is configured on our system - I'm not exactly a hardware guy. Anyone have any ideas where I can start looking? I'm not able to do anything with remote PC commands, or moving the PDF to a different system - I have to print it entirely self-contained from a network printer from our IBM i.

              Thanks!

              Comment


              • #8
                Re: Printing IFS documents on network printers

                On green screen does the LPR command works fine ?
                Patrick

                Comment


                • #9
                  Re: Printing IFS documents on network printers

                  I did get this working from CLP. Could have sworn I had more examples than this ...

                  Code:
                  PGM                                                
                                                                     
                  STRPCO                                             
                                                                     
                  MONMSG     MSGID(IWS4010)                          
                                                                     
                  STRPCCMD   PCCMD('START AcroRd32.exe /t +          
                               "T:\MHASTON\TEST.PDF"') PAUSE(*NO)    
                                                                     
                  ENDPGM

                  My T:\ is mapped to the IFS.
                  Your friends list is empty!

                  Comment


                  • #10
                    Re: Printing IFS documents on network printers

                    Originally posted by K2r400 View Post
                    On green screen does the LPR command works fine ?
                    I believe it's working just fine. I assume it's working fine during the QSH session as well, because I do end up with data in a spooled file.

                    I tried a different method of printing - Scott Klement's PRTSTMF command, http://www.scottklement.com/PrtStmf.zip - unfortunately, it doesn't appear my printer will understand PDF data natively, so I'm now looking at methods to convert to PCL or PS via GhostScript.

                    Comment


                    • #11
                      Re: Printing IFS documents on network printers

                      Success! I'll post back when I've got this developed into a more streamlined process, but I was able to print the PDF!

                      Comment


                      • #12
                        Re: Printing IFS documents on network printers

                        cool cant wait to see it....


                        Jamie
                        All my answers were extracted from the "Big Dummy's Guide to the As400"
                        and I take no responsibility for any of them.

                        www.code400.com

                        Comment


                        • #13
                          Re: Printing IFS documents on network printers

                          Bump,

                          I am looking at this same scenario in which I need to print IFS stored PDF's to a network printer, Hey Vitaemachina did you get your code streamlined? Could you post what you have?
                          Thanks

                          Comment


                          • #14
                            Re: Printing IFS documents on network printers

                            Vitaemachina,

                            You mentioned in a post regarding this topic that you'd found a solution that worked well for printing PDF documents to an iSeries Network Printer.

                            I've been trying to figure out how to do this for a good amount of time and have looked for solutions on the web, but none have worked for me. All of the examples I've seen point to similar solutions, but there seems to be a missing piece.

                            Can you provide details about your solution?

                            Thanks

                            Comment


                            • #15
                              Re: Printing IFS documents on network printers

                              I found this solution that is working well for me. It consists of installing AFP Fonts on your PC and running STRPCO on the PC to move the PDF files from the IFS to an iSeries output queue. Here are some details. Charlie
                              Actions Needed:
                              --Create an iSeries output queue - crtoutq pdfprint (no special settings are needed)
                              --Create a NetServer Print Share using iSeries Navigator providing only the Share Name and Output Queue
                              --On the PC, create a Network Printer that connects to the Share decribed here. See the process below.
                              --An iSeries CL program that uses STRPCO to move the IFS objects to an iSeries output queue. Code Sample below.

                              Create a Network Printer on the PC:
                              --From the desktop, select "Start | Printers and Faxes | Add a Printer"
                              --Click Next on the wizard window
                              --Select "Network Printer" and press Next
                              --Select "Connect to this printer" and use name "\\<yourSysnameHere>\PDFPRINT$"
                              *Press OK if an error window appears indicating "The server for the printer does not have the correct printer driver installed",
                              --Select "Have Disk" on the "Add Printer Wizard" window
                              --Click "Browse" on the "Install From Disk" window and select "C:\ca400\CWBAFP\cwbasp.inf". Then select Ok
                              --Select "Generic IBM 600dpi AFP" Printer and click OK <----- Maybe we can use 300dpi here
                              --Select "No" on the "Default Printer" prompt and click Next
                              --Select "Finish"
                              CL Program to move the IFS objects to an iSeries output queue:
                              PHP Code:
                              Pgm                                            
                                                                             
                              Dcl        
                              var(&QshCmd)    type(*charlen(256)
                              Dcl        var(&PDFCount)  type(*charlen(8)  
                              Dcl        var(&FileName)  type(*charlen(100)
                              Dcl        var(&SysName)   type(*charlen(8)  
                                                                             
                              DclF       file(libname/PDFFILELST)     <--- this file was created using the crtpf with record length 200                                               
                              RtvNetA    sysname
                              (&SYSNAME)                   

                              StrPco                                                           
                              MonMsg     msgid
                              (IWS4010)                                        
                              /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
                              CrtDtaAra  dtaara(QGPL/PDFCounttype(*CHARlen(8)              
                              MonMsg     msgid(CPF0000)                                        
                                                                                               
                              ChgVar     var(&QSHCMDvalue('ls -tr +                          
                                             /home/PDFFiles | wc -l | datarea  +        
                                             -w /qsys.lib/qGPL.lib/PDFCount.dtaara'
                              )           
                              Qsh        cmd(&QshCmd)                                          
                              MonMsg     msgid(CPF0000)                                        
                                                                                               
                              RtvDtaAra  dtaara(QGPL/PDFCountrtnvar(&PDFCount)               
                              DltDtaAra  dtaara(QGPL/PDFCount)                                 
                              MonMsg     msgid(CPF0000)                                        
                              If         
                              cond(&PDFCount *EQ '       0'then(Do)               
                                 
                              SndPgmMsg  msg('There are no files available for printing +   
                                                 in /home/PDFFiles.'
                              )                   
                                 GoTo       
                              End                                                
                              EndDo                                                            

                              ChgVar     
                              var(&QSHCMDvalue('ls -tr +                          
                                           /home/PDFFiles/* > +                         
                                           /qsys.lib/yourLibName.lib/PDFFileLst.file/PDFF+         
                                           FILELST.mbr'
                              )                                         
                              Qsh        cmd(&QshCmd)                                          
                              MonMsg     msgid(CPF0000)                                        
                                                                                               
                              Read:    RcvF                                                             
                              MonMsg     msgid
                              (CPF0864exec(GOTO End)                         
                                                                                               
                              ChgVar     var(&QSHCMDvalue('START AcroRd32.exe /p /t +        
                                           "e:' 
                              *tcat &PDFFILELST *tcat +                       
                                           
                              '" "\\' *tcat &SysName *tcat '\PDFPRINT$"')           
                              StrPCCmd   pccmd(&QSHCMDpause(*NO)                             
                                                                                               
                              GoTo       
                              cmdlbl(Read)                                          
                              /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

                              End:    EndPgm 

                              Comment

                              Working...
                              X