Hello dear members of the forum.
I have created a PL/SQL process that generates a report in PDF format based on a Jasper Studio template (generating correctly showing the relevant data), however when the attachment is opened from the client's mail inbox , the document is blank.
My code is:
declare
l_body clob;
l_body_html clob;
l_email varchar2(60);
l_proc varchar2(100) := 'show report';
l_additional_parameters varchar2(32767);
l_blob blob;
l_mime_type varchar2(30):='application/pdf';
l_mensaje_id number;
begin
l_body:= 'Reciba un cordial saludo. Enviamos la siguiente orden de pedido.<br>Cordiales';
BEGIN
xlib_jasperreports.set_report_url('http://xyz:8090/JasperReportsIntegration/report');
-- construct addional parameter list
l_additional_parameters := 'P_PRESUPUESTO_ID=' || apex_util.url_encode(:P34_PRESUPUESTO);
xlib_jasperreports.get_report (p_rep_name => 'xyz/FMGPresupuesto',
p_rep_format => 'pdf',
p_data_source => 'xyz',
p_rep_locale => 'en_US',
p_rep_encoding => 'UTF-8',
p_additional_params => l_additional_parameters,
p_out_blob => l_blob,
p_out_mime_type => l_mime_type
);
--apex_application.stop_apex_engine;
END;
l_mensaje_id:=apex_mail.send(
p_to => 'robert_antoni792012@yahoo.com',
p_from => 'report@xyzemail.xyz',
p_body => l_body,
p_body_html => NULL,
p_subj => 'Presupuesto del Cliente');
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_mensaje_id,
p_attachment => l_blob,
p_filename => 'Presupuesto_Nro_'||:P34_PRESUPUESTO||'.pdf ',
p_mime_type => l_mime_type);
commit;
l_body_html:=null;
dbms_lob.freetemporary (l_blob);
end;
Thanks for your help.