Forum Stats

  • 3,750,250 Users
  • 2,250,140 Discussions
  • 7,866,859 Comments

Discussions

How to print directly from oracle forms to the default printer

Iker Garcia Martin
Iker Garcia Martin Member Posts: 26 Red Ribbon

Hello,

Is it possible to print from oracle forms to local printers without them being configured in weblogic? I launch a report but not in PREVIEW and I want it to be printed by a local printer

Environment Data:

Oracle Weblogic 12.2.1.4

Oracle Forms 12.2.1.4

Thanks,

Iker

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    Forms has nothing to do with Reports. Your question should actually be:

    "How to print directly from Oracle Reports to the default printer"

    All Forms does with regard to Reports is to tell Reports to run a job. What Reports does with that job is a function of Reports and not Forms. Think of it as "fire and forget it". Forms says; " Reports, please run this report...". It is then up to Reports to decide what to do with the result based on how Reports is configured.

    That said, there really is no supported way to send a job directly to an individual's default printer because the output of the job is created on the server. You must first bring the output to the user's machine before it can be printed. Once on the local machine it is easy to print it.

    Using WebUtil for the task is fairly simple. Just run the report (i.e. RUN_REPORT_OBJECT) then when the output has been created, use WebUtil to download the output file to the local machine. Once on the local machine use WebUtil to open it or send it directly to the printer. If desired, the file can be deleted when finish or whenever you prefer.

  • Iker Garcia Martin
    Iker Garcia Martin Member Posts: 26 Red Ribbon

    Hi Michel,

    Just run the report then when the output has been created on server.

    I use the command webutil_file_transfer.as_to_client('c:/prueba/stockprueba.pdf','/tmp/stockprep.pdf') to download the file to the local machine. Once on the local machine, how send directly to the printer wit webutil?

    To delete the file, i use  webutil_file.delete_file('c:/prueba/stockprueba.pdf');

    Thanks,

    Iker

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    You need to either contact Adobe to determine exactly what command line switches they expose for Acrobat, but as far as I know the following should work on Windows:

    "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /t "C:\filetoprint.pdf"

    So here is an example of how you might do it in Forms code:

    WEBUTIL_HOST.NONBLOCKING ('"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /t "C:\myfiletoprint.pdf"');
    

    It is possible that this will result in Acrobat remaining open. This may not be avoidable using this method. There are third party utilities that can be used to directly print and not orphan the executable. Do some Googling ;-)

    Again, for help printing PDF files you should contact Adobe. Note there may be some licensing issues associated with attempting to directly print PDF files. I seem to recall that the EULA for Acrobat used to not permit doing this with Acrobat Reader.