Sending a Password protected PDF using utl_smtp [message #658373] |
Mon, 12 December 2016 02:35 |
|
dineshkumar18
Messages: 28 Registered: September 2016
|
Junior Member |
|
|
Dear AM using UTL_SMTP for attaching a PDF file but now i do have password protected PDF file and am not been able to attach the password protected file:
declare
l_clob clob;
vInhandle_read utl_file.file_type;
vNewLine long;
BEGIN
vInHandle_read := utl_file.fopen('STMT_DIR', '4010367765001.pdf', 'R');
LOOP
begin
utl_file.get_line(vInHandle_read,vNewLine);
exception
when no_data_found
then
EXIT;
end;
l_clob:=l_clob|| chr(10) || vnewline;
end loop;
utl_file.fclose(vInHandle_read);
dbms_output.put_line( 'the clob is ' || length(l_clob) || ' bytes' );
exception
when others
then
if (utl_file.is_open(vInHandle_read))
then
utl_file.fclose(vInHandle_read);
end if;
RAISE;
END;
4010367765001.pdf is a password protected pdf.
Attached the error message which am getting.
But am able to get the output for normal PDF
Kindly advise
[mod-edit: image inserted into message body by bb]
-
Attachment: test.jpg
(Size: 32.53KB, Downloaded 2063 times)
[Updated on: Mon, 12 December 2016 03:20] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: Sending a Password protected PDF using utl_smtp [message #658422 is a reply to message #658373] |
Tue, 13 December 2016 07:55 |
Solomon Yakobson
Messages: 3275 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Your code is wrong to begin with. It can have problems regardless if PDF is password protected or not. PDF is binary, not text file. So why are you trying to read it into CLOB? Use BLOB instead. Opening PDF using UTL_FILE with R format implies text file with lines <= 1024 (including EOL characters). UTL_FILE will fail if EOL is not found within next 1024 bytes. Mode RB is used to read binary files via UTL_FILE. But why are you using UTL_FILE to begin with? Use BFILENAME.
SY.
|
|
|
|
|