begin
-- Call the procedure
rep1.genpdf;
--download
sys.htp.init;
sys.owa_util.mime_header('application/pdf', false);
sys.htp.p('Content-length: ' || sys.dbms_lob.getlength(rep1.v_pdf));
sys.htp.p('Content-Disposition: download; filename="' || 'rep1.pdf' || '"');
sys.htp.p('Cache-Control: max-age=3600');
sys.owa_util.http_header_close;
sys.wpg_docload.download_file(rep1.v_pdf);
apex_application.stop_apex_engine;
end;