Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Direct printing from JRI/Apex without showing the PDF in browser? #41

#1

Hi,

we've set up JRI for evaluation.
Showing Jasper reports from Apex and sending Jasper reports to printers (direct printing) works.
But if we call

xlib_jasperreports.show_report(
p_rep_name => apex_util.url_encode('my_report'),
p_rep_format => apex_util.url_encode('pdf'),
p_data_source => apex_util.url_encode('my_data_source'),
p_print_is_enabled => true,
p_print_printer_name => 'my_print_queue',
p_print_duplex => true
);

the report is sent to my_print_queue and the PDF is opened in browser.
How can we just send to print_queue without showing the PDF in browser.

We are using:
Apex 22.1.3
JRI 2.8.1
Tomcat 9.0

Many thanks,
Tobi

  • solved #2
  • replies 3
  • views 1.2K
  • likes 1
#2

Hi Tobi,

for a situation like this I would use the following code:

DECLARE
   l_blob        BLOB;
   l_mime_type   VARCHAR2 (100);
BEGIN  
   xlib_jasperreports.get_report (p_rep_name => apex_util.url_encode('my_report'),
          p_rep_format          => apex_util.url_encode('pdf'),
          p_data_source         => apex_util.url_encode('default'),
--          p_additional_params   => '&'  || apex_util.url_encode('parameter1')
--                                   ||'='|| apex_util.url_encode('parameter value 1'),
          p_print_is_enabled    => true,
          p_print_printer_name  => apex_util.url_encode('my_print_queue'),
          p_out_blob            => l_blob,
          p_out_mime_type       => l_mime_type                                   
          );
   DBMS_LOB.freetemporary (l_blob);
END;

This will generate the report and store it in a BLOB variable. This BLOB can then be stored in the database, sent via email or simply ignored ... what we did in this example.

Best
~Dietmar.

tmwac · Author
#3

Hi Dietmar,

just tested your code.
It works perfectly for me.

Many thanks,
Tobi

tmwac accepted post #2 as the answer
#4