How to open pdf report in Oracle Form? [message #83892] |
Sun, 28 December 2003 16:21 |
Yang Chen
Messages: 1 Registered: December 2003
|
Junior Member |
|
|
I have created an Oracle report in PDF format using the following code. How do I open it from Oracle form?
Thanks in advance.
--Yang Chen
DECLARE
pl_id ParamList;
file_name VARCHAR2(100);
BEGIN
pl_id := Get_Parameter_List('tmpdata');
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List('tmpdata');
file_name :='C:temptest.pdf';
Add_Parameter(pl_id,'ORACLE_SHUTDOWN', TEXT_PARAMETER, 'Yes');
Add_Parameter(pl_id,'ORIENTATION',TEXT_PARAMETER,'LANDSCAPE');
Add_Parameter(pl_id,'DESFORMAT',TEXT_PARAMETER,'PDF');
Add_Parameter(pl_id,'DESTYPE',TEXT_PARAMETER,'file');
Add_Parameter(pl_id,'DESNAME',TEXT_PARAMETER,file_name);
Add_Parameter(pl_id,'PARAMFORM', TEXT_PARAMETER, 'YES');
Run_Product(REPORTS,'C:temptestreport', ASYNCHRONOUS, RUNTIME,FILESYSTEM,pl_id);
--How do I open file C:temptest.pdf?
END;
|
|
|
Re: How to open pdf report in Oracle Form? [message #83894 is a reply to message #83892] |
Sun, 28 December 2003 21:45 |
Remash
Messages: 52 Registered: November 2000
|
Member |
|
|
Declare
Mcnt Number;
Mextn Varchar2(25);
Mxtype Varchar2(100);
Mpath Varchar2(150);
Mfile Varchar2(100);
Mname Varchar2(25);
Begin
--Following is an example to open a pdf file (or any other file by changing the extension name in Mextn variable) in Microsoft Windows. I'm using Forms 5.0 with WIN_API utility.
Mextn := '.pdf';
Mname := 'C:temptest.pdf';
--Get the program name and the location of the program to open the pdf file from the registry
Begin
Mxtype := Win_Api_Environment.Read_Registry ('HKEY_CLASSES_ROOT'||Mextn,'',TRUE);
Exception
When Others Then
Message('NO PROGRAM FOUND TO LOAD THIS FILE');
Return;
End;
Begin
Mpath := Win_Api_Environment.Read_Registry
('HKEY_CLASSES_ROOT'||Mxtype||'ShellOpenCommand','',TRUE);
Exception
When Others Then
Message('NO PROGRAM FOUND TO LOAD THIS FILE');
Return;
End;
--To check whether an executable file
Mcnt := Instr(Upper(Mpath),'.COM');
If NVL(Mcnt,0) > 0 Then
Mpath := Substr(Mpath,1,Mcnt+3);
Else
Mcnt := Instr(Upper(Mpath),'.EXE');
If NVL(Mcnt,0) > 0 Then
Mpath := Substr(Mpath,1,Mcnt+3);
Else
Message('PROGRAM EXTENSION IS NOT EXE OR COM');
Return;
End if;
End if;
--Following is to clean up the filename and path read from the registry
If Substr(Mpath,1,1) = '"' Then
Mpath := Mpath||'"';
End if;
Mfile := '"'||Mname||'"';
--To open the file
Begin
Win_Api_Shell.WinExec (MPath||' '||Mfile,WIN_API.SW_SHOWMAXIMIZED,TRUE);
Exception
When Others Then
Message('COULD NOT RUN THE PROGRAM TO LOAD THIS FILE');
Return;
End;
Exception
When Others Then
Message(SQLERRM);
End;
|
|
|
Re: How to open pdf report in Oracle Form? [message #83895 is a reply to message #83892] |
Sun, 28 December 2003 21:57 |
Frank Naude
Messages: 4589 Registered: April 1998
|
Senior Member |
|
|
Hi,
If the reports are on your local machine, use the "host" command to open them. Try something like
Alternatively, if your reports are on a remote machine, use a web server to make them accessible across the network. Clients can then access the web server via built-ins such as:
HOST('iexplore.exe URL');
WEB.SHOW_DOCUMENT('http://host/xyz.pdf')
Best regards.
Frank
|
|
|
|