Hi,
I have a requirement to download IDM document (PDF) via Mongoose. I am able to download the PDF file but the format is corrupted and unable to view it via PDF viewer. Any help is appreciated.
Endpoint: /api/items/{pid}/resource/stream
Code:
method = "/items/" + templatePid + "/resource/stream";
parameters = new InvokeParameterList{"1","0","IDM/api","GET",method,{string.Empty, true },"application/json",
"10000",{ string.Empty, true },{ string.Empty, true },{ string.Empty, true },{ string.Empty, true }};
InvokeRequestData request = new InvokeRequestData();
InvokeResponseData resp;
request.IDOName = "IONAPIMethods";
request.MethodName = "InvokeIONAPIMethod";
request.Parameters = parameters;
resp = IDOClient.Invoke(request);
var res = resp.Parameters[9].Value;
IWSIDOCollection PCol = ThisForm.PrimaryIDOCollection;
PCol.SetCurrentObjectProperty("binaryDoc", Convert.ToBase64String(Encoding.UTF8.GetBytes(res))); // binaryDoc datatype is Binary
PCol.SetCurrentObjectModified( true);
ThisForm.GenerateEvent("Export");
PCol.SetCurrentObjectModified( false );
Export Event:
Thanks,
Supriya