7 Replies Latest reply on Mar 18, 2016 9:07 PM by PamNL

    Printer - Concurrent Program

    SudheerReddy

      Hi,

       

      I have a requirement like, need to print a PDF file ( which is located at UNIX folder) from concurrent program, file name as parameter. Is this possible, if possible can you please guide me how to do?

      I can use PLSQL or UNIX shell concurrent programs.

       

      Thanks in advance.

       

      Reddy

        • 1. Re: Printer - Concurrent Program
          Hussein Sawwan-Oracle

          Please see:

           

          How to Generate PDF Output With UTF8 in R12? (Doc ID 778970.1)

          How To Print Concurrent Requests in PDF Format (Doc ID 333504.1)

           

          Not sure what you mean by "file name as parameter".

           

          Thanks,

          Hussein

          • 2. Re: Printer - Concurrent Program
            PamNL

            We used something like

             

            lp -oraw myfile.pdf

             

            So your concurrent program will be a host script with something like this

             

            INSTALL_DATE=`date +%Y%m%d%H%M%S`

             

            # -----------------------------------------------------

            # Obtain program arguments and populate FCDF variables

            # -----------------------------------------------------

            if (test "$GET_ARG" != "GET_ARG") then

               arguments="$@"; export arguments

               GET_ARG=GET_ARG; export GET_ARG

               exec /bin/ksh -c "$0 $arguments"

            else

              echo Install date: $INSTALL_DATE

            fi

             

            shift

             

            for i in $1 $2 $3 $4 $5 $6 $7

            do

                eval $i

                shift

            done

             

            export FCP_REQID FCP_LOGIN FCP_USERID FCP_USERNAME

            export FCP_PRINTER FCP_SAVE_OUT FCP_NUM_COPIES

             

            PRINT_COMMAND=$1

            FILE_NAME=$2

             

            $PRINT_COMMAND $FILE_NAME

             

            Now print_command and file_name are both parameters. Print_command was defaulted to lp -oraw

             

            Hope this helps ..

            • 3. Re: Printer - Concurrent Program
              PamNL

              This is an example of a friend of mine which converts the PDF to PCL, adds trays to it and prints it ... (thanks to Derk vP).

              Hope this is useful for you too.

               

              #!/bin/ksh

              ##########################################################################

              #

              # This script converts PDF print files to PCL.

              # Then includes the tray information in each postscript file .

              ########################################################################

               

              #parameters

              FILENAME=$1

              PRINTER=$2

              COPIES=$3

              CONC_REQUEST_ID=$4

               

              #variables

              TMP_FILENAME=$FILENAME.tmp

              PCL_FILENAME=$FILENAME.pcl

               

              #function to insert tray number

              insert_tray()

              {

                   # $1 = tray value

                   # $2 = source file

                   # $3 = target file

                 

                   sed 's/\x1B\&l1X/\x1B\&l1X\x1B\&l'$1'H/g' $2 > $3

              }

               

              get_tray_num()

              {

                   # $1 = CONC_REQUEST_ID

              CONN_STRING=`cat $ORACLE_HOME/reports60/server/CGIcmd.dat |grep $TWO_TASK|grep html|awk ' { print $2 } ' |awk -F= ' { print $2 } '`

                 

              TRAYNUM=$(sqlplus -S $CONN_STRING <<EOF

              set heading OFF termout ON trimout ON feedback OFF

              set pagesize 0

              SELECT cp.attribute1 FROM fnd_concurrent_requests cr, fnd_concurrent_programs cp WHERE cp.concurrent_program_id = cr.concurrent_program_id AND cr.request_id = $1;

              exit;

              EOF)

              }

               

              #query the traynumber

              get_tray_num $CONC_REQUEST_ID

               

              #convert to pcl

              gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=a4 -sOutputFile=$TMP_FILENAME -f $FILENAME

               

              # if traynumber not found,

              if [ "$TRAYNUM" = "" ]; then 

                lp -d $PRINTER -n $COPIES $TMP_FILENAME

                rm $TMP_FILENAME

              else

                 

               

                  if [ -f $TMP_FILENAME ]; then

                      #insert correct tray number

                      insert_tray $TRAYNUM  $TMP_FILENAME $PCL_FILENAME

                      echo "inserted tray number"

                      rm $TMP_FILENAME

                  fi

               

                  if [ -f $PCL_FILENAME ]; then

                      #send to printer

                      lp -d $PRINTER -n $COPIES $PCL_FILENAME

                      echo "sent to printer"

                      rm $PCL_FILENAME

                  fi

               

              fi

               

              exit 0

              • 4. Re: Printer - Concurrent Program
                SudheerReddy

                Thank you Pam, I will try and let you know. I hope this is going to work.

                 

                Hussain,

                Thank you, I would to like pass the file name as parameter and Concurrent program needs to pick that file and send to printer.

                 

                Thanks

                Reddy

                • 5. Re: Printer - Concurrent Program
                  SudheerReddy

                  Pam,

                   

                  I can see tray number, which is coming from Attribute1, I dont think this is standard one because i can see null value. Can you pls guide me where i can get tray number value?  Is this based on printer or printer queue?

                   

                  Thanks

                  Sudheer

                  • 6. Re: Printer - Concurrent Program
                    SudheerReddy

                    Pam,

                    I removed Tray Number options, it is required if you have special driver with special prints. I am good with A4, and commented that options. It working for me. Key is PCL converter.

                     

                    Thanks for your help.

                    • 7. Re: Printer - Concurrent Program
                      PamNL

                      Great that it works! Indeed, this was for tray printing, which is slightly more complex, but good you got it to work!