wpg_docload.download_file in safari
Hello
I use apex 4.2 with oracle DB EE 11, I table include the PDF of blob, that I have to post this document in page, I try to use the function below his successfly to work with IE9, but in safari and chrome does not and display question marks?
Any suggestion?
declare v_lob blob; begin SELECT a.presentation_file into v_lob FROM lec_lectures a where lec_seq = 1; owa_util.mime_header('application/pdf', false); owa_util.http_header_close; wpg_docload.download_file(v_lob); end;
This code exactly what I have, that is to say its successfully but in safari and chrome screen display data from Pippa
Tags: Database
Similar Questions
-
Cannot use WPG_DOCLOAD.download_file to Apex 4.2.1
Hi guys,.
I came across the following problem. We recently migrated Apex 4.0 to 4.2.1 and a procedure to open an RTF document filled with the settings of a selected folder.
He has always worked with the a procedure that calls the following line: WPG_DOCLOAD.download_file ()l_doc();
Now, 4.2.1 it does nothing, does not give an error if a push of the button.
Everyone knows the same problem? I already searched the internet but never found a solution.
Thanks in advance.
After all the answers, I wonder if there was some communication problems.
Your process code should look like this:
l_filename := r_brief.template_naam; l_mime_type := r_brief.template_mime; v_document_clob := GEN$PL_UTILS.blob_to_clob(r_brief.template_blob); v_document_clob := GEN$PL_UTILS.replace_tags_in_clob(v_document_clob , tab_temp_tags_values, tab_temp_toegelaten_tags, v_replace_error); l_doc := GEN$PL_UTILS.clob_to_blob(v_document_clob); l_length := DBMS_LOB.getlength(l_doc); htp.init; OWA_UTIL.mime_header (l_mime_type); HTP.p ('Content-length: ' || l_length); HTP.p ('Content-Disposition: attachment; filename="'||REPLACE(REPLACE(SUBSTR(l_filename,INSTR(l_filename,'/')+1),CHR(10),NULL),CHR(13),NULL)||'"'); OWA_UTIL.http_header_close; WPG_DOCLOAD.download_file (l_doc); apex_application.stop_apex_engine;
Notice the init of lines 7 and the stop_apex_engine at the ned.
For the test of htp.p ('Hello'), just replace line 12, but we would like to lines 7-11 it to replicate the download.
In addition, because you want to stay on the same page. In my opinion, this code should be on the processes that are running on the Page rendering side of things.
I hope this helps.
Thank you
-Jorge
-
I work with APEX 4.1
Within the application under development, it is a requirement to be able to select several lines in an interactive report, then click a button to download them in ZIP file.
Currently, a field that contains a list delimited by two points of ID values to determine which rows to download, like ": 17:127:
By submitting the page files are selected and zipped through a process, then downloaded by the same process.
This is the process of PL/SQL for zip and download:
add1file and finish_zip are stored procedures.declare g_zipped_blob blob; b_dl_file BLOB; v_filename VarChar(1000); begin for rec in ( select FILE_ID, FILENAME, FILE_BLOB from DD_FILES where instr(:P9_FILE_ID, ':' || FILE_ID || ':') > 0) LOOP zip_blobs.add1file( g_zipped_blob, rec.FILENAME, rec.FILE_BLOB ); end loop; zip_blobs.finish_zip( g_zipped_blob ); select sysdate into v_filename from dual; owa_util.mime_header( 'application/octet', false ); htp.p('Content-length: ' || dbms_lob.getlength(g_zipped_blob)); htp.p('Content-Disposition: attachment; filename="'|| v_filename ||'.zip"'); owa_util.http_header_close; wpg_docload.download_file(g_zipped_blob); --dbms_lob.freetemporary( g_zipped_blob); end;
Currently, by pressing the button, nothing happens (but the page is submitted, nothing seems to be happening), although when the testing process, it returns what seems to be a text version of the BLOB (within the section of the workshop SQL SQL commands).
A few reasons why this is happening?
Already posted this in the section of PL/SQL, but it seems to have been ignored.Hello
Rather than present the page I would try to open a new page (for example, by calling popUpNamed) passing the ID as a parameter to this page. Then have your download process as a before the process of header on this page.
Use apex_application.g_unrecoverable_error: = TRUE; at the end of your code to make sure that nothing on the page that deals with this page is actually executed.
Rod West
-
Download BLOB via wpg_docload does not
Hello
I installed a new oracle database server and recently installed the 4.1 Apex then transferred my legacy data and applications from the old server.
My new configurations are
My oracle Enterprise Manager displaysOracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
Previously I had Apex 4.0.1 on Apex listener through the Glassfish server and all my applications worked perfectly. But on the new installation of the page that downloads report, via the rtf code generation and it downloaded from the BLOB does not work.Hosts 1 Application Servers 1 OC4J Instances 1 HTTP Server Instances 1
I searched and didn't find any help, but it seems that there is a problem of configuration of DAD. My DAD file looks likeDeclare l_mime varchar2 (255); l_length number; l_file_name varchar2 (2000); l_lob_loc blob; l_rtf clob; l_name varchar2(100); -- conversion variables l_src_offset number := 1; l_dest_offset number := 1; l_lang_ctx number := 0; l_warning varchar2(32767); begin -- get name select 'testrtf' into l_name from dual; -- generate document select :P16_RTF into l_rtf from dual; --:P16_RTF contains rtf code. -- convert to lob dbms_lob.createtemporary(l_lob_loc, false); dbms_lob.converttoblob(l_lob_loc, l_rtf, DBMS_LOB.GETLENGTH(l_rtf), l_dest_offset, l_src_offset, 0, l_lang_ctx, l_warning); l_length := dbms_lob.getlength(l_lob_loc); -- http header owa_util.mime_header('application/rtf', false); htp.p('Content-length: ' || l_length); htp.p('Content-Disposition: attachment; filename="'||l_name||'.rtf"'); owa_util.http_header_close; -- download blob wpg_docload.download_file (l_lob_loc); end;
and I could not find wwv_flow_file_objects$ either. All of the suggestions.<Location /pls/apex> Order deny,allow PlsqlDocumentPath docs AllowOverride None PlsqlDocumentProcedure wwv_flow_file_mgr.process_download PlsqlDatabaseConnectString db:1521:orcl ServiceNameFormat PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8 PlsqlAuthenticationMode Basic SetHandler pls_handler PlsqlDocumentTablename wwv_flow_file_objects$ PlsqlDatabaseUsername APEX_PUBLIC_USER PlsqlDefaultPage apex PlsqlDatabasePassword ****** PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize Allow from all </Location>
Concerning
Sabir
Published by: sabir786 on December 29, 2011 11:37Hi sabir786,
I had exactly the same problem. I went to my request of APEX 4.0 and Oracle 10 g to 4.1 APEX and Oracle 11 g, then all download functions via wpg_docload stopped calling the download dialog box.
Now, I tried some kind of workaround to find the feature.
Rather than use page-processes to call the download functions, I tried to use enforcement procedures (called on request) and it works fine.that is to say:
an application process named 'export' called at the requestStart
(#OWNER) # .f_export
v_EXPTYP =>: P10_EXPORT_TYPE,
v_ID =>: F_PROJEKT_ID
);
end;a button that calls a branch with the following query
APPLICATION_PROCESS = export
f_export is the function that generates the rtf file and in the end, it has the wpg_docload functions to download the file.
Hope it helps you as well.
Concerning -
Download JasperServer for Apex
Hi all
my need is to directly call a jasperrepor in an apex and download/preview the pdf application.
I found many times procedures using utl_http, dbms_lob, owa_util and wpg_docload as:
- http://damien.antipa.at/2011/11/04/apex-and-jasperserver-tunnel-plugin/
- An another Blog of Oracle: JasperReports in Apex
It seems to work fine, but on line
owa_util.mime_header('application/pdf');
This error is triggered
ORA-06502: PL/SQL: digital error or value
ORA-06512: at "SYS." OWA_UTIL", line 356
ORA-06512: at "SYS." HTP", line 1368
ORA-06512: at "SYS." HTP", line 1443
ORA-06512: at "SYS." HTP", line 1735
ORA-06512: at line 76 level
I ' am works with Application Express 4.1.1.00.23 and Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
Thank you all for any help or suggestion.
PS: my second necessity will add a line like this
HTP.p ('Content-Disposition: inline ;');)
to preview the pdf document in the browser without the open/save dialog box, I'm on the right track?
Hi OraclePSP,
Please try the following code:
procedure JasperReport ( p_report_name varchar2 default 'Blank_A4' , p_parameter varchar2 default '&ID=850' , p_output_format varchar2 default 'pdf') is g_user_agent VARCHAR2(255) := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/A.B (KHTML, like Gecko) Chrome/X.Y.Z.W Safari/A.B.'; v_url varchar2(4000); v_request sys.utl_http.req; v_response sys.utl_http.resp; v_file blob; v_download raw(32767); v_mime_header varchar2(64) ; nm owa.vc_arr; vl owa.vc_arr; BEGIN -- init the cgi environment nm(1) := 'DUMMY_JUST_TO_SET_UP_OWA_UTIL'; vl(1) := 'WHATEVER'; owa.init_cgi_env( nm.count, nm, vl ); v_url := 'http://myUser:myPwd@myHost:myPort/jasperserver/rest_v2/reports/'||p_report_name||'?'||p_parameter; v_request := sys.utl_http.begin_request(v_url); sys.utl_http.set_header(v_request, 'User-Agent', g_user_agent); v_response := sys.utl_http.get_response(v_request); dbms_lob.createtemporary(v_file, TRUE, dbms_lob.session); LOOP BEGIN sys.utl_http.read_raw(v_response, v_download); dbms_lob.writeappend(v_file, utl_raw.length(v_download), v_download); EXCEPTION WHEN sys.utl_http.end_of_body THEN EXIT; END; END LOOP; sys.utl_http.end_response(v_response); owa_util.mime_header('application/' || nvl(p_output_format,'octet'), false); htp.p('Content-length: ' || dbms_lob.getlength(v_file)); htp.p('Content-Disposition: inline; filename="' || p_report_name || '.'|| p_output_format ||'"'); owa_util.http_header_close; wpg_docload.download_file(v_file); dbms_lob.freetemporary(v_file); END JasperReport;
This has something to do with the CGI environment initialization. (I used owa_util.mime_header several times in versions of Oracle Database 11 g, but not been confronted with this error)
Reference: https://asktom.oracle.com/pls/asktom/f?p=100:11:P11_QUESTION_ID:347617533333
Also do a forum search or google search you will find many discussions and links related to the same topic.
I hope this helps!
Kind regards
Kiran
-
APEX 4.2
Oracle 11g
I would like the user to preview a form (document) front of e-mail or print it.
I have a database table called FORMS_LETTERS. The table contains all the forms that can be distributed.
I create a page that contains a box containing two elements. The first element (Pxxx_ID) contains the ID of the table, the 2nd itme (Pxxx_DOCUMENT) is an element of display_image I want to display the pdf file; the source is BLOB_CONTENT. :
When I run the page, I get the following screen. I need to right click and choose View Image to see a preview of the document. I want to automatically preview (i.. e, without right clicking and clicking on picture).
How to achieve this?
Robert.
> The 2nd itme (Pxxx_DOCUMENT) is an element of display_image I want to display the file pdf. the source is BLOB_CONTENT
A PDF file is not an image, so that does not work like that.
You can embed a PDF document to preview. Google for "html embed pdf" or something like that, for example:
Recommended method to incorporate PDFS into HTML? -Stack overflow
Or specifically for Apex, for example
In Apex, you generally just download a PDF help
wpg_docload.download_file.
There are many examples that we would find too.
-
Apex Oracle 5.0 - download
Hi all
(1) I loaded the template file to .csv files on behalf of the table called Temp.
My requirement, I am trying to download the data blob to the loaded file.
https://Apex.Oracle.com/en/APEX_TEMP?p_file=100
created procedure code:
create or replace
PROCEDURE apex_temp (p_file in number) AS
v_mime VARCHAR2 (48);
V_LENGTH NUMBER;
v_file_name VARCHAR2 (2000);
Lob_loc BLOB;
BEGIN
SELECT MIME_TYPE, BLOB_CONTENT, FILE_NAME DBMS_LOB. GETLENGTH (BLOB_CONTENT)
IN lob_loc, v_file_name, v_mime, v_length
TEMP
WHERE FILE_ID = p_file;
owa_util.mime_header (nvl(v_mime,'application/octet'), FALSE);
HTP.p ("Content-length: ' |") v_length);
HTP.p ('Content-Disposition: attachment; filename = "" | ") Replace (Replace (substr (v_file_name, InStr(v_file_name,'/') + 1), Chr (10), null), Chr (13), null). '"');
owa_util.http_header_close;
wpg_docload.download_file (Lob_loc);
end;
When I run this URL -https://apex.oracle.com/en/APEX_TEMP?p_file=100
FILE will download, my question here do not have to download, error you are not authorized to access the requested resource.
Please help me to solve this... apex 5.0
Hi Mike-Oracle,
Gwendoline-Oracle wrote:
I'm facing another problem with tablur form-> formof 5-Tablur Apex
can you please help...
Passes by the wire. The solution suggested by Ramani_apex is what I would have suggested as well.
If this is not what you want, then re - produce your question on apex.oracle.com and share the credentials from the workspace.
Kind regards
Kiran
-
Hi team,
Version - Oracle APEX 5.0.1
Our company has a new requirement where we must pass several SQL queries (which report queries will be stored in the shared-> components) and which must be downloaded into SEVERAL spreadsheets (.) XLSX format) using report layouts.
1. is this a feasible requirement using any plugin?
2. is it a feasible requirement using Oracle BI Publisher (we are willing to invest on licenses, if we can see all POC is already done)
Please shed some light on it.
Thank you
Sunil Bhatia
Hi Sunil,
Sunil Bhatia wrote:
Currently, I used the code when a click on the following button: but the problem persists, how to export.
As pointed out by Anton, you can include the code to export the Excel as follows:
begin -- build the excel file as_xlsx.clear_workbook; as_xlsx.new_sheet( 'employees' ); as_xlsx.query2sheet( 'select * from emp' ); as_xlsx.new_sheet( 'departments' ); as_xlsx.query2sheet( 'select * from dept' ); -- download the excel file htp.init; owa_util.mime_header( 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', false ); htp.p( 'Content-Disposition: attachment; filename=empdept.xlsx' ); owa_util.http_header_close; wpg_docload.download_file( as_xlsx.finish ); end;
But still, I prefer to separate the strengthening process of download excel file.
Kind regards
Kiran
-
How to create a text file of apex
Hello.
I have apex 5 user and I need to create a txt file to format a report ANSI classic interactive report or query.
I need a TXT, CSV file because this file allows it to import into another application.
Is it Possible? How?
Thank you!!
Hmm, could be done in a select statement in a variable:
DECLARE l_Clob_Item CLOB;
l_Length NUMBER;
SELECT Col1 | Col2. COL4 IN l_Clob;
l_Length: =.
DBMS_LOB.GETLENGTH( l_Clob);
Next, you need to write code to allow download of the clob machine local users
owa_util.mime_header('application/octet', FALSE );
htp.p('Content-length: ' || l_length);
htp.p('Content-Disposition: attachment; filename="My_text_File"');
owa_util.http_header_close;
wpg_docload.download_file( l_Clob );
apex_application.stop_apex_engine;Something like this should work...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
Can someone please help me on how to generate excel file using pl/sql? I have generated csv files successfully, but now I need to generate a excel. I changed the code generation of the csv file, but the file gives me error when opening:
"The file you are trying to open,"XXXX.xls", is in a different format than specified by the file extension. Do you want to open it now? »
If I choose Yes then open the excel file, but it excludes the leading 0 in the front for one my column. How do I configure excel type default column as text rather than General, when you create the files? I also tried to generate excel file using xml. But I do not know how to set the type of column there, too. I'm using Oracle 11.2.0.3.0 and APEX 4.2.6.00.03. I'll call all these codes apex.
Code1 is used:
Declare
output_header varchar2 (4000);
fichier_en_sortie VARCHAR2 (255);
Varchar2 (2) EOL: = Chr (13) | Chr (10);
BEGIN
output_header: = 'tls_tracking_id ' | Chr (9) | ' fnn_ext' | Chr (9) | "path_id' | EOL;
fichier_en_sortie: = 'report_excel' |'. XLS;
owa_util.mime_header ("application/octet ', false");
HTP.p ('Content-Disposition: attachment; filename = "" | ") fichier_en_sortie |' « ') ;
owa_util.http_header_close;
HTP. PRN (output_header);
for r in)
Select tls_tracking_id, fnn_ext, DWD_DTOV_OUT_VW path_id
where nbn_loc_id = 'LOC000138413115. '
The order of tls_tracking_id LOOP)
HTP. PRN (r.tls_tracking_id
|| Chr (9) | r.fnn_ext
|| Chr (9) | r.path_id
|| EOL
);
END LOOP;
END;
Code2 used :
create or replace PACKAGE BODY IS pkg_excel_export
PROCEDURE excel_open (l_xml_body IN OUT NOCOPY CLOB) IS
BEGIN
l_xml_body: = ' <? XML version = "1.0" encoding = "ISO-8859-9"? > ' | Chr (10) |
"< workbook xmlns =" "urn: schemas-microsoft - com:office:spreadsheet" ' | "
Chr (10) |
""xmlns:o ="urn: schemas-microsoft-com ' ' |
Chr (10) |
"xmlns: x =" "urn: schemas-microsoft-com: excel" ' | "
Chr (10) |
""xmlns:ss ="urn: schemas-microsoft - com:office:spreadsheet" ' |
Chr (10) |
'xmlns:html=" http://www.w3.org/TR/REC-html40 ">' ||
Chr (10) |
' < ExcelWorkbook xmlns = "urn: schemas-microsoft-com: excel" > ' |
Chr (10) | ' < WindowHeight > 8580 < / WindowHeight > ' |
Chr (10) | ' < WindowWidth > 15180 < / WindowWidth > ' | Chr (10) |
' < WindowTopX > 120 < / WindowTopX > ' | Chr (10) |
' < WindowTopY > 45 < / WindowTopY > ' | Chr (10) |
' < ProtectStructure > false < / ProtectStructure > ' | Chr (10) |
' < ProtectWindows > false < / ProtectWindows > ' | Chr (10) |
' < / ExcelWorkbook > ' | Chr (10) | "< Styles > | Chr (10) |
'< ss:ID of style = 'Default' ss:Name 'Normal' = >' | Chr (10) |
"< ss:Vertical alignment = 'Bottom' / >" | " Chr (10) |
' < borders / > '. Chr (10) | ' < police / > '. Chr (10) |
' < Interior / > '. Chr (10) | ' < NumberFormat / > '. Chr (10) |
' < protection / > '. Chr (10) | "< / style > | Chr (10) |
'< ss:ID of style 's22' = >' | Chr (10) |
"< x: font family = ss"Swiss":"BOLD"="1"ss:Underline ="Single"/ >" | "
Chr (10) | "< / style > | Chr (10) | "< / style >";
END excel_open;
PROCEDURE excel_close (l_xml_body IN OUT NOCOPY CLOB) IS
BEGIN
l_xml_body: = l_xml_body | ' < / workbook > ';
END excel_close;
/ * Opens a worksheet in the Excel file. , You can open multiple worksheets. **/
PROCEDURE worksheet_open
(
l_xml_body IN OUT NOCOPY CLOB,
p_worksheetname in VARCHAR2
) IS
BEGIN
--
-Create the worksheet
--
l_xml_body: = l_xml_body | "' < worksheet ss:Name = ' ' | p_worksheetname |
"" > < table > ";"
END worksheet_open;
/ *Farm the worksheet in the Excel file. **/
PROCEDURE worksheet_close (l_xml_body IN OUT NOCOPY CLOB) IS
BEGIN
l_xml_body: = l_xml_body | ' < / table > < / worksheet > ';
END worksheet_close;
/ *Opens the tag line * /
PROCEDURE row_open (l_xml_body IN OUT NOCOPY CLOB) IS
BEGIN
l_xml_body: = l_xml_body | "< row >."
END row_open;
/ *Farm the tag line * /.
PROCEDURE row_close (l_xml_body IN OUT NOCOPY CLOB) IS
BEGIN
l_xml_body: = l_xml_body | "< / row > | Chr (10);
END row_close;
/ *After the opening of the line, we can write something the first cell* /
PROCEDURE cell_write
(
l_xml_body IN OUT NOCOPY CLOB,
p_content in VARCHAR2
) IS
BEGIN
l_xml_body: = l_xml_body | ' < cell > < data ss:Type = "String" > ' |
p_content | ' < / data > < / cell > ';
END cell_write;
/ * If you use this package of APEX, you get to download the excel file. **/
PROCEDURE excel_get
(
l_xml_body IN OUT NOCOPY CLOB,
p_filename in VARCHAR2
) IS
XX BLOB;
make the NUMBER;
This NUMBER;
BC NUMBER.
LC NUMBER;
w NUMBER;
BEGIN
DBMS_LOB.CREATETEMPORARY (xx, TRUE);
make: = 1;
so: = 1;
BC: = dbms_lob.default_csid;
LC: = dbms_lob.default_lang_ctx;
w: = dbms_lob.no_warning;
DBMS_LOB.converttoblob (xx,
l_xml_body,
DBMS_LOB.lobmaxsize,
do,
Thus,.
British Colombia,
LC,
(w);
owa_util.mime_header ("application/octet ', FALSE");
-set the size so that the browser knows how to download
HTP.p ("Content-length: ' |") DBMS_LOB.GetLength (xx));
-the name of the file will be used by the browser if users only one save as
HTP.p ('Content-Disposition: attachment; filename = "" | ") p_filename |
'.xls ' | '"');
-close the headers
owa_util.http_header_close;
-Download the BLOB
wpg_docload.download_file (XX);
END excel_get;
END pkg_excel_export;
I know it's a bit long code, but to better understand please consider...
Thank you.
I did worked putting just one extra line in my l_xml_body in the XML (Code 2 used). Now my excel generates with cells type 'Text' and there are no left falling to zero. Also the columns display not scientific format as 2.3D + 12. Current recording shows without default formatting.
'
-
Picture is not displayed in the photo gallery
Dear friend,
Apex worm 4.2.6
I want to create a photo gallery in my application so
I create a page and try a code to view images in the Gallery, but Image is not displayed in my Gallery.
I have tried to create the gallery as below link Photo Gallery
http://www.jssor.com/demos/image-gallery.html
Please, help us create like this gallery.
I create the sample page in my workspace. Please follow below reference identifiers
Workspace: APEX_ISSUE
User name: [email protected]
Password: kaushik1@34
Application 92353 - Gallery
Page n - 2
Please help us.
Thank you
Hi Maxence,
Created sample in your Application of 92353-> Page 7 - dynamic photo gallery (as mentioned in approach).
Does the following on page 7:
- Article "HTML Header" of the deleted page the JS code and moved the folder references to the 'file URL' and moved the JavaScript about cursor to 'Function and Variable global statement' in Page attributes-> JavaScript section.
- Removed the CSS code in "Source of the region" and moved to the Page attributes-> CSS-> section Inline.
- ODP created to download the images as mentioned in the blog post from Joel mentioned above:
begin for c1 in (select * from gallery_image_dtl where id = :FILE_ID) loop sys.htp.init; sys.owa_util.mime_header( c1.mimetype, FALSE ); sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( c1.service_image)); sys.htp.p('Content-Disposition: inline; filename="' || c1.file_name || '"' ); sys.htp.p('Cache-Control: max-age=3600'); -- tell the browser to cache for one hour, adjust as necessary sys.owa_util.http_header_close; sys.wpg_docload.download_file( c1.service_image ); apex_application.stop_apex_engine; end loop; end;
- Changed the type of area ' PL/SQL (anonymous block' and 'Source of the region:
declare cursor c_gallery_img is select id from gallery_image_dtl; l_buffer varchar2(30000); l_link varchar2(512) := 'f?p='||:APP_ID||':0:'||:APP_SESSION||':APPLICATION_PROCESS=GETIMAGE:::FILE_ID:'; begin l_buffer := '
I hope this helps!
Kind regards
Kiran
-
Display PDF in a PL/SQL region - APEX 4.2
I'm trying to display a pdf file in a PL/SQL area in the same page APEX. First of all, I went through the following threads, but none of them worked for me:
How to display the pdf file in the apex region
I have a dynamic region of PL/SQL with the source:
declare n_file_id number; v_file varchar2(255); v_source varchar2(255); begin v_source := 'MAXIS_RENEWAL.DRIVER_FILE_API.download_file_upload?p_file='||:P250_X_FILE_ID; HTP.P(V_SOURCE); htp.p('<div style="">'); htp.p('<embed height="900" width="800" name="embed_content" src="'||v_source||'" type="application/pdf" />'); htp.p('</div>'); end
The download_file_upload procedure is as follows:
PROCEDURE DOWNLOAD_FILE_UPLOAD(p_file in number ) AS v_mime VARCHAR2(4000); v_length NUMBER; v_file_name VARCHAR2(2000); Lob_loc BLOB; LOC VARCHAR2(10); BEGIN SELECT MIME_TYPE, BLOB_CONTENT, filename,DBMS_LOB.GETLENGTH(blob_content) Into V_Mime,Lob_Loc,V_File_Name,V_Length FROM MAXIS_RENEWAL.library_docs_imp WHERE id = p_file; -- -- set up HTTP header -- -- use an NVL around the mime type and -- if it is a null set it to application/octect -- application/octect may launch a download window from windows owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE ); -- set the size so the browser knows how much to download htp.p('Content-length: ' || v_length); -- the filename will be used by the browser if the users does a save as --htp.p('Content-Disposition: attachment; filename="'||substr(v_file_name,instr(v_file_name,'/')+1)|| '"'); htp.p('Content-Disposition: inline; filename="'||substr(v_file_name,instr(v_file_name,'/')+1)|| '"'); -- close the headers owa_util.http_header_close; -- download the BLOB wpg_docload.download_file( Lob_loc ); exception when others then --log error htp.p('ERROR DOWNLOAD FILE: '||sqlerrm); end download_file_upload;
With the current version, it only downloads the pdf on FireFox and IE. On Chrome, it will not. It will display only the string 'MAXIS_RENEWAL. "DRIVER_FILE_API.download_file_upload? p_file = xxxsomeID" in the region.
When I copy the string and passed in the url of the browser, it downloads the files.
I can't really understand the problem. Any help is deeply appreciated.
Hi Hawk333,
Hawk333 wrote:
v_source: = ' MAXIS_RENEWAL. DRIVER_FILE_API.download_file_upload? = p_file'|: P250_X_FILE_ID;
Is it possible to hide this?
Yes, I think that you have kept the following line in your PL/SQL dynamic content area, that is why it displays:
declare n_file_id number; v_file varchar2(255); v_source varchar2(255); begin v_source := 'MAXIS_RENEWAL.DRIVER_FILE_API.download_file_upload?p_file='||:P250_X_FILE_ID; -- remove this line from your code -- is this for debugging purpose? -- HTP.P(V_SOURCE); htp.p('
'); htp.p(''); htp.p(''); end;I hope this helps!
Kind regards
Kiran
-
APEX 4.2.3 consume the web service returning a PDF problem
Using APEX 4.2.3 on a database of Oracle 11 g R2, Firefox 31.7, we ask a service web restful one before the process of page header, to download a PDF Code file used:
declare
CLOB l_clob;
l_blob blob.
l_sql_delimiter varchar2 (30);
l_lang_context integer: = DBMS_LOB. DEFAULT_LANG_CTX;
l_warning integer: = DBMS_LOB. WARN_INCONVERTIBLE_CHAR;
l_dest_offset integer: = 1;
l_source_offset integer: = 1;
l_Json VARCHAR2 (4000);
Start
l_clob: = null;
DBMS_LOB.CREATETEMPORARY (l_blob, true);
-Generate here the content of your file in l_clob.
hr_Pkg.Security_Termination_Form(:P4200_PERSON_HR_ID,l_Json);
hr_Pkg.call_rest_webservice (l_Json, 'TestME.Pdf', l_Clob);
Logger.log ('CLOB SIZE IN PAGE: ' | sys.) DBMS_LOB. GetLength (l_clob));
sys. HTP.init;
sys.owa_util.mime_header (' application/pdf', FALSE, 'UTF-8');
sys. HTP.p ("Content-length: ' |") sys.DBMS_LOB.GetLength (l_clob));
sys. HTP.p ('Content-Disposition: attachment; filename = "TestME.Pdf" ');
sys.owa_util.http_header_close;
() DBMS_LOB.converttoblob
dest_lob = > l_blob,
src_clob = > l_clob,
amount = > DBMS_LOB. LOBMAXSIZE,
dest_offset = > l_dest_offset,
offset = > l_source_offset,
blob_csid = > DBMS_LOB. DEFAULT_CSID,
lang_context = > l_lang_context,
WARNING = > l_warning
);
Logger.log ("SIZE of BLOB: ' |") sys. DBMS_LOB. GetLength (l_blob));
sys.wpg_docload.download_file (l_blob);
apex_application.stop_apex_engine;
exception when others then
sys. HTP. PRN (' error: ' |) SQLERRM);
apex_application.stop_apex_engine;
end;
We run in the question, that the PDF file is empty with the exception of a few fill-able fields that must be completed in advance by the call to the web service.
When you run the web service directly from the browser, the PDF that is generated is very well and seems to be complete. And the size of the file that is created as the clob from the web service call is exactly the same size it as the pdf file received directly from the web service.
When we compare the size of the clob to the size of the blob, we see that the blob is slightly larger in size than the clob.
Any suggestions? (Sample code for posting to the hosted site for Oracle will not work because you can not call the hosted instance web services and web service is hosted BEHIND our firewall).
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILLProblem is resolved... As opposed to the use of the APEX apex_web_service.make_rest_request must use the utl_http.begin_request and then treats the query returned through utl_http. READ_RAW and who then saving it in a temporary BLOB.
Maybe when we update to the APEX 5, I'll see if I can deal with it using standard APEX packages...
Thank you
Tony Miller
Software LuvMuffin
Salt Lake City, UT -
Display an image BLOB in a report of the APEX
Hello
I have a BLOB column in a table that contains an image I want to display in a report.
The table definition for the table (MAG_IMAGES) that I store the BLOB in is:
CREATE TABLE 'MAG_IMAGES '.
(NUMBER OF 'MAG_IMAGE_ID',
VARCHAR2 (200) "NUMERO_IMAGENOM_IMAGE."
BLOB "CONTENT."
'MIME_TYPE' VARCHAR2 (1000).
NUMBER OF "DOC_SIZE."
'CONTENT_TYPE' VARCHAR2 (1000).
VARCHAR2 (20) "DISPLAY_AREA."
TIMESTAMP 'LAST_UPDATE_DATE' (6).
ENABLE 'MAG_IMAGES_PK' CONSTRAINT PRIMARY KEY ('MAG_IMAGE_ID')
)
/
It's the Vendor_Group Table where I store the Image_Id.
CREATE TABLE 'VENDOR_GROUP '.
(NUMBER OF 'VENDOR_GROUP_ID',
VARCHAR2 (100) "VENDOR_GROUP_NAME."
"IMAGE_ID" NUMBER
ENABLE 'VENDOR_GROUP_PK' CONSTRAINT PRIMARY KEY ('VENDOR_GROUP_ID')
)
/
I created the following procedure IMAGE_DISPLAY, which I have from a previous discussion forum.
create or replace PROCEDURE image_display (p_image_id number)
AS
l_mime VARCHAR2 (255);
l_length NUMBER;
l_file_name VARCHAR2 (2000);
l_content BLOB;
BEGIN
SELECT content, Mime_type DBMS_LOB.getlength (content)
IN l_mime, l_content, l_length
OF mag_images
WHERE mag_image_id = p_image_id;
OWA_UTIL.mime_header (NVL (l_mime, "application/octet"), FALSE);
HTP.p ("Content-length: ' |") l_length);
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (l_content);
EXCEPTION
WHEN OTHERS RAISE.
END image_display;
I then create a region of APEX report with the following source:
Select a.group_product_list,
' < img src = "image_display? p_image_id =' | NVL(a.image_id,0) | "" height ="" | 100. "" / > "photo
vendor_group a, mag_images b
where image_id = b.mag_image_id (+)
and mag_vendor_id = 2;
The Image does not appear, but it looks like this below. I put the column attribute 'Standard report Column '.
Can someone please tell me what I'm doing wrong?
Thanking you in advance
Dominic
Dominic Dovale wrote:
Hello
I tried to recreate the region from scratch, even in another page altogether but still no luck.
If I run the report without defining the column in a BLOB with its attributes (MIMETYPE column, Table etc.), he does not fail, but returned the following, which is of course the length of the BLOB. The problem only occurs if I set the attributes. Any other suggestions?
Include MAG_IMAGE_ID as a hidden column in the report.
-
File as blob upload and display an image
I created a browse file to store the files as BLOB in a table. File mail in table but are unable to view
File can be image, pdf, text, etc.
Found an example and tried to implement but can't get the image to display.
Do not know what Miss me?
I created an example
https://Apex.Oracle.com/pls/Apex/f?p=54811:1:7357315146564:
whiskers
I created a table
CREATE TABLE 'MY_BLOB '.
(VARCHAR2 (7) "IMAGE_KEY",)
VARCHAR2 (400) "IMAGE_FILENAME."
VARCHAR2 (48) "IMAGE_MIME_TYPE."
NUMBER OF "IMAGE_DOC_SIZE."
'IMAGE_CONTENT_TYPE' VARCHAR2 (255),
'BLOB_CONTENT' BLOB,
KEY ELEMENTARY SCHOOL ("IMAGE_KEY")
INDEX USING ACTIVATE
)
and ran the process to transfer the file as a BLOB in the table
declare
number of V_LENGTH;
number of image_pk_hld;
Whole CNT;
Start
Select doc_size from v_length
of wwv_flow_files
WHERE name =: P1_FILEBROWSE;
If v_length < = 1000000 then
Select count (*) in the my_blob cnt;
If cnt > 0 then
Select max (image_key) + 1 image_pk_hld
of my_blob;
on the other
image_pk_hld: = 100;
end if;
: P1_BLOB_PK: = image_pk_hld;
insert into MY_BLOB (IMAGE_KEY, IMAGE_FILENAME,
IMAGE_MIME_TYPE, IMAGE_DOC_SIZE, IMAGE_CONTENT_TYPE,
BLOB_CONTENT)
Select image_pk_hld, FILENAME, MIME_TYPE,
DOC_SIZE, CONTENT_TYPE, BLOB_CONTENT
of wwv_flow_files
WHERE name =: P1_FILEBROWSE;
delete from wwv_flow_files where name =: P1_FILEBROWSE;
on the other
delete from wwv_flow_files where name =: P1_FILEBROWSE;
commit;
raise_application_error (-20001,' cannot upload images larger than 1 MB!');
end if;
exception
while others then
raise_application_error (-20001, "Error when downloading image!");
end;
then tried to view the file (the file can be an image, text, pdf, etc.) in a region of pl/sql
declare
MimeType VARCHAR2 (255);
Start
Select IMAGE_MIME_TYPE in the mimetype
of my_blob
where IMAGE_KEY =: P1_BLOB_PK;
If the MIME type is not null or type MIME! = "THEN
HTP.p ("< img src =" display_image? p_image_id =' |: P1_BLOB_PK |') "" height = "'. 500 | » » / >') ;
on the other
HTP.p ('No Image');
END IF;
HTP.p (' ');
end;
procedure display_image
create or replace PROCEDURE display_image ()p_image_id IN VARCHAR2,( )
ACE
l_mime VARCHAR2 (255) ;
l_length number ;
l_file_name VARCHAR2 (2000) ;
lob_loc BLOB ;
Start
Choose IMAGE_MIME_TYPE BLOB_CONTENT
DBMS_LOB.getlength()BLOB_CONTENT() IMAGE_FILENAME
en l_mime, lob_loc, l_length, l_file_name
de my_blob
où image_key = p_image_id;
owa_util.mime_header ()NVL()l_mime "application/octet"() FALSE()
htp .p (' Content-length: ' | ) l_length );
owa_util.http_header_close
wpg_docload.download_file()lob_loc()
end display_image ;
pam499057 wrote:
Thanks for the reply.
I have given the procedure.
So I think that you must provide the credentials of developer to your workspace on apex.oracle.com so that we can investigate the problem.
examples uploading files a better way
See page 6 of the database Application example.
There is also a tutorial OBE which followed the introduction of the declarative BLOB support in 3.1 that is always topical in 4.x.
Maybe you are looking for
-
Problem with Windows Vista user account management
When you go to user accounts in Control Panel, I automatically get up my account but when I click on 'manage other accounts' and continue, I get a screen saying click account you want to manage but no icons or accounts don't appear in the box below?
-
HP 110-194: Issue of BIOS
I am trying to load Kali Linux alongside Windows 8.1 and I know how do it. My question is in the BIOS, there is no option to boot from the DVD before Windows. I checked carefully, but the only options are CD or USB. I tried USB, but failed to get
-
What is this TeamViewer dot com and why should I not go?
Slow moving Machine
-
CIsco Anyconnect VPN with LDAP AAA
Hi there, I was hoping that someone can point me in the right direction here. I created a VPN connection profile to match anyconnect SSL entering customers. I would like to use LDAP group membership as a sine qua non for authentication. I found a few
-
Microsoft Mobile Mouse soluble problem by exchanging the transceivers?
Hello I have my third Microsoft Wireless Mobile Mouse 4000. The first two had one of their mouse buttons stopped working does not correctly one after more than two years, it is not perfect, but I can tolerate that, I really like this mouse otherwise.