PL/PDF reporting in HTML DB environment
This page shows how to call a PL/PDF report from HTML DB. Please follow these steps:
- Create an HTML DB page that has form fields that serve as parameters to the report
- The HTML DB page should also contain a button that when pressed, the values of the parameter fields are passed to the report and the report is opened in another window
- The HTML DB page in the background in the meantime jumps to another HTML DB page
Detailed steps:
- Create the PL/PDF report: The report has a P_SESSION_ID parameter that receives the actual runtime application ID. The report code has to contain a PLPDF_SESSION_IS_VALID function that verifies the session ID. If the session is invalid it returns a FALSE value and the PL/PDF report fails with an error message. If the session is valid it returns a TRUE value and prepares the PDF output according to the transferred parameters. Example:
CREATE OR REPLACE PROCEDURE REP1(p_session_id NUMBER, p_par1 NUMBER) IS l_blob BLOB; BEGIN IF PLPDF_SESION_IS_VALID(p_session) THEN << PL/PDF API Calls Here >> ELSE htp.p('Invalid Session'); END IF; END; /
- The next step is to prepare the HTML DB page that the HTML DB parameter page will automatically call after the report is generated. This could be an already existing page.
- Now only the HTML DB parameter page that actually calls the PL/PDF report must be prepared:
- Create the input items that will serve as parameters to the PL/PDF report.
- The "HTML Header" section should contain the following JavaScript:
<script language="JavaScript" type="text/javascript"> function callMyRep() { var formVal1 = document.getElementById('P_PAR1').value; var url; url = 'rep1?p_session_id=&SESSION.'+'&p_par1='+ formVal1; window.location.href="f?p=&APP_ID.:12:&SESSION."; w = open(url,"winRep","Scrollbars=1,resizable=1,width=800,height=600"); if (w.opener == null) w.opener = self; w.focus(); } </script>
Where "12" is the ID of the page, that is called automatically by the HTML DB parameter page. c. Create the button that will call the PL/PLDF report. This button points to a URL that is returned by the JavaScript:
javascript:callMyRep();
This insures the integration of the PL/PDF report into HTML DB by only allowing sessions from HTML DB to call the PL/PDF reports.
|