Forum Stats

  • 3,757,137 Users
  • 2,251,200 Discussions
  • 7,869,739 Comments

Discussions

rendered pdf report to be open in new tab

AQH
AQH Member Posts: 297 Blue Ribbon
edited Aug 30, 2021 9:46AM in APEX Discussions

i am running successfully apex integrated with jasperserver. regards and thanks to https://dietmaraust.com/jasperreportsintegration,

all i need to open my rendered report in new tab, i have to through examples but no success, my Before Header plsql code (execute in Button 'show button' Submit is :

*i am using apex 18 and db:11g


declare

 l_proc varchar2(100) := 'show report';

 l_report_url varchar2(32767 char) := :p0_report_url;

BEGIN

 xlog (l_proc, 'url (orig):' || l_report_url);


 xlib_jasperreports.set_report_url(l_report_url);

 xlib_jasperreports.show_report (p_rep_name => apex_util.url_encode('test'),

     p_rep_format     => apex_util.url_encode(:p5_rep_format),

     p_data_source     => apex_util.url_encode(:p5_data_source),

     p_out_filename    => apex_util.url_encode('test.pdf'),

     p_rep_locale     => apex_util.url_encode('en_US'),

     p_rep_encoding    => apex_util.url_encode('UTF-8'),

     p_additional_params  => :p5_additional_params,

     p_print_is_enabled  => case when :p5_print_is_enabled='1' then true else false end,

     p_print_printer_name => apex_util.url_encode(:p5_print_printer_name),

     p_print_media     => apex_util.url_encode(:p5_print_media),

     p_print_copies    => apex_util.url_encode(:p5_print_copies),

     p_print_duplex    => case when :p5_print_duplex='1' then true else false end,

     p_print_collate    => case when :p5_print_collate='1' then true else false end,

     p_save_is_enabled   => case when :p5_save_is_enabled='1' then true else false end,

     p_save_filename    => apex_util.url_encode(:p5_save_filename),

     p_rep_time_zone    => apex_util.url_encode(:p5_rep_time_zone),

     p_print_job_name   => apex_util.url_encode(:p5_print_job_name)

     );

  

 -- this was used before apex 4.1

 --apex_application.g_unrecoverable_error := true;

 apex_application.stop_apex_engine;


exception

 when others then 

  xlog(l_proc, substr(dbms_utility.format_error_backtrace,1,3500), 'ERROR');

  raise;

end;

Comments

  • Awais Majeed
    Awais Majeed Member Posts: 111 Bronze Badge

    Try to render url and call in apex_util.prepare_url

    SELECT ...

     'javascript:apex.navigation.openInNewWindow('''||

       apex_util.prepare_url('f?p='

                           ||:APP_ID||':102:'                -- app id

                           ||:APP_SESSION||':RUN_REPORT:'    -- session and request

                           ||:DEBUG                          -- continue to pass existing debug

                           ||'::P102_DUTY_SLIP_NO:'||yourjobnocolumn  -- no clear cache, set page value with jobno

                           ||':')

     ||''');' print_url

     ...

     FROM your table

    AQH
  • AQH
    AQH Member Posts: 297 Blue Ribbon

    the said plsql code define in Before Header page going to execute when Button Submit click, can you please reply how can i use your define example with this