base64_encode of a pdf file
Posted: Wed Jan 29, 2025 8:16 am
Hi,
I'm using base64_encode to work with a pdf file.
I read the pdf content with get_clob_from_file,
Then I put the encoded data in a json ( variable name : request)
and send it by http_req
But the pdf received is different than the original,
(It shows just the template model without the customized data)
Where could be the mistake ?
Thanks
This is an extract of the code:
dcl-s MioFile sqltype(clob:16773100);
dcl-s UTF8Data varchar(16773100) ccsid(1208);
dcl-s encoded char(16773100);
dcl-s request varchar(16773100);
exec sql
set :MioFile = get_clob_from_file(trim(:path));
UTF8Data = %Trim(MioFile);
outputlen = base64_encode(%addr(UTF8Data:*data)
: %Len(UTF8Data)
: %addr(encoded)
: %Len(encoded));
I'm using base64_encode to work with a pdf file.
I read the pdf content with get_clob_from_file,
Then I put the encoded data in a json ( variable name : request)
and send it by http_req
But the pdf received is different than the original,
(It shows just the template model without the customized data)
Where could be the mistake ?
Thanks
This is an extract of the code:
dcl-s MioFile sqltype(clob:16773100);
dcl-s UTF8Data varchar(16773100) ccsid(1208);
dcl-s encoded char(16773100);
dcl-s request varchar(16773100);
exec sql
set :MioFile = get_clob_from_file(trim(:path));
UTF8Data = %Trim(MioFile);
outputlen = base64_encode(%addr(UTF8Data:*data)
: %Len(UTF8Data)
: %addr(encoded)
: %Len(encoded));